define("app/mixin/enums", [],
function() {
    "use strict";
    return function() {
        var e = Object.freeze({
            UNAUDIT: {
                code: 0,
                description: "待确认"
            },
            CANCELED: {
                code: 1,
                description: "已取消"
            },
            UNPAID: {
                code: 2,
                description: "未付款"
            },
            PAID: {
                code: 3,
                description: "已付款"
            },
            REFUNDING: {
                code: 4,
                description: "退款中"
            },
            REFUNDED: {
                code: 5,
                description: "已退款"
            }
        }),
        t = Object.freeze({
            CASH: {
                code: 0,
                description: "现金支付"
            },
            WECHAT: {
                code: 1,
                description: "微信支付"
            },
            ALIPAY: {
                code: 2,
                description: "支付宝支付"
            }
        }),
        i = Object.freeze({
            UNUSED: {
                code: 0,
                description: "未使用"
            },
            USED: {
                code: 1,
                description: "已使用"
            },
            EXPIRED: {
                code: 2,
                description: "已过期"
            },
            REFUND: {
                code: 3,
                description: "已退款"
            }
        }),
        n = Object.freeze({
            GROUPON: {
                code: 0,
                description: "闪购"
            },
            RESERVE: {
                code: 1,
                description: "预定"
            },
            ANNUAL_DINNER: {
                code: 2,
                description: "年夜饭"
            }
        }),
        o = Object.freeze({
            GROUPON: {
                code: 1,
                description: "闪购"
            },
            BANQUET: {
                code: 2,
                description: "宴席"
            },
            MEETING: {
                code: 4,
                description: "会务"
            }
        }),
        a = Object.freeze({
            MALE: {
                code: 0,
                description: "男"
            },
            FEMALE: {
                code: 1,
                description: "女"
            }
        }),
        r = Object.freeze({
            LUNCH: {
                code: "12:00",
                description: "午市"
            },
            DINNER: {
                code: "18:00",
                description: "晚市"
            }
        });
        return function() {
            this.enums = function() {
                return {
                    orderStatus: e,
                    paymentMethod: t,
                    couponStatus: i,
                    productType: n,
                    gender: a,
                    lunchOrDinner: r,
                    businessType: o
                }
            }
        }
    } ()
}),
function(e, t) {
    "function" == typeof define && define.amd ? define("layzr", [], t) : "object" == typeof exports ? module.exports = t() : e.Layzr = t()
} (this,
function() {
    "use strict";

    function e(e) {
        this._lastScroll = 0,
        this._ticking = !1,
        e = e || {},
        this._optionsContainer = document.querySelector(e.container) || window,
        this._optionsSelector = e.selector || "[data-layzr]",
        this._optionsAttr = e.attr || "data-layzr",
        this._optionsAttrRetina = e.retinaAttr || "data-layzr-retina",
        this._optionsAttrBg = e.bgAttr || "data-layzr-bg",
        this._optionsAttrHidden = e.hiddenAttr || "data-layzr-hidden",
        this._optionsThreshold = e.threshold || 0,
        this._optionsCallback = e.callback || null,
        this._retina = window.devicePixelRatio > 1,
        this._srcAttr = this._retina ? this._optionsAttrRetina: this._optionsAttr,
        this._nodes = document.querySelectorAll(this._optionsSelector),
        this._handlerBind = this._requestScroll.bind(this),
        this._create()
    }
    return e.prototype._requestScroll = function() {
        this._optionsContainer === window ? this._lastScroll = window.pageYOffset: this._lastScroll = this._optionsContainer.scrollTop + this._getOffset(this._optionsContainer),
        this._requestTick()
    },
    e.prototype._requestTick = function() {
        this._ticking || (requestAnimationFrame(this.update.bind(this)), this._ticking = !0)
    },
    e.prototype._getOffset = function(e) {
        return e.getBoundingClientRect().top + window.pageYOffset
    },
    e.prototype._getContainerHeight = function() {
        return this._optionsContainer.innerHeight || this._optionsContainer.offsetHeight
    },
    e.prototype._create = function() {
        this._handlerBind(),
        this._optionsContainer.addEventListener("scroll", this._handlerBind, !1),
        this._optionsContainer.addEventListener("resize", this._handlerBind, !1)
    },
    e.prototype._destroy = function() {
        this._optionsContainer.removeEventListener("scroll", this._handlerBind, !1),
        this._optionsContainer.removeEventListener("resize", this._handlerBind, !1)
    },
    e.prototype._inViewport = function(e) {
        var t = this._lastScroll,
        i = t + this._getContainerHeight(),
        n = this._getOffset(e),
        o = n + this._getContainerHeight(),
        a = this._optionsThreshold / 100 * window.innerHeight;
        return o >= t - a && i + a >= n && !e.hasAttribute(this._optionsAttrHidden)
    },
    e.prototype._reveal = function(e) {
        var t = e.getAttribute(this._srcAttr) || e.getAttribute(this._optionsAttr);
        e.hasAttribute(this._optionsAttrBg) ? e.style.backgroundImage = "url(" + t + ")": e.setAttribute("src", t),
        "function" == typeof this._optionsCallback && this._optionsCallback.call(e),
        e.removeAttribute(this._optionsAttr),
        e.removeAttribute(this._optionsAttrRetina),
        e.removeAttribute(this._optionsAttrBg),
        e.removeAttribute(this._optionsAttrHidden)
    },
    e.prototype.updateSelector = function() {
        this._nodes = document.querySelectorAll(this._optionsSelector)
    },
    e.prototype.update = function() {
        for (var e = this._nodes.length,
        t = 0; e > t; t++) {
            var i = this._nodes[t];
            i.hasAttribute(this._optionsAttr) && this._inViewport(i) && this._reveal(i)
        }
        this._ticking = !1
    },
    e
}),
define("app/application", ["backbone", "marionette", "app/mixin/enums", "layzr"],
function(e, t, i, n) {
    "use strict";
    var o = t.Application.extend({
        initialize: function(e) {
            this.ctx = window._config.context,
            this.res = window._config.res7niu,
            this.api = window._config.context + "/api"
        }
    });
    i.call(o.prototype);
    var a = new o;
    return a.navigate = function(t, i) {
        i || (i = {}),
        e.history.navigate(t, i)
    },
    a.getCurrentRoute = function() {
        return e.history.fragment
    },
    a.on("before:start",
    function() {
        var e = t.LayoutView.extend({
            el: "#app",
            regions: {
                page: "#page"
            }
        });
        a.rootView = new e
    }),
    a.on("start",
    function() {
        e.history && (e.history.start({
            pushState: !0,
            root: a.ctx
        }), "" === this.getCurrentRoute() && a.trigger("product:list")),
        this.layzr = new n
    }),
    a.commands.setHandler("layzr:refresh",
    function() {
        a.layzr.updateSelector(),
        a.layzr.update()
    }),
    a
}),
define("app/mixin/currency", [],
function() {
    "use strict";
    return function() {
        this.currency = function(e, t) {
            return (e / 100).toFixed(t || 0)
        }
    }
}),
define("app/model/product", ["backbone", "app/application", "app/mixin/currency"],
function(e, t, i) {
    "use strict";
    var n = e.Model.extend({
        urlRoot: t.api + "/products",
        defaults: {
            name: "",
            description: "",
            price: 0,
            cover: t.ctx + "/static/images/default-cover.png"
        }
    });
    return i.call(n.prototype),
    n
}),
define("app/collection/products", ["underscore", "backbone", "app/application", "app/model/product", "paginator"],
function(e, t, i, n) {
    "use strict";
    return t.PageableCollection.extend({
        model: n,
        url: i.api + "/products",
        mode: "infinite",
        state: {
            pageSize: 10
        },
        queryParams: {
            geoCode: void 0,
            productType: function() {
                return this.productType
            }
        },
        initialize: function(t, i) {
            e.extend(this, i)
        }
    })
}),
define("app/model/recommend", ["backbone"],
function(e) {
    "use strict";
    return e.Model.extend({})
}),
define("app/collection/recommends", ["backbone", "app/application", "app/model/recommend"],
function(e, t, i) {
    "use strict";
    return e.Collection.extend({
        model: i,
        url: function() {
            return t.api + "/recommends/" + this.type
        },
        initialize: function(e, t) {
            this.type = t.type
        }
    })
}),
define("text", ["module"],
function(e) {
    "use strict";
    var t, i, n, o, a, r = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"],
    s = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
    l = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
    d = "undefined" != typeof location && location.href,
    c = d && location.protocol && location.protocol.replace(/\:/, ""),
    p = d && location.hostname,
    h = d && (location.port || void 0),
    u = {},
    m = e.config && e.config() || {};
    return t = {
        version: "2.0.14",
        strip: function(e) {
            if (e) {
                e = e.replace(s, "");
                var t = e.match(l);
                t && (e = t[1])
            } else e = "";
            return e
        },
        jsEscape: function(e) {
            return e.replace(/(['\\])/g, "\\$1").replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r").replace(/[\u2028]/g, "\\u2028").replace(/[\u2029]/g, "\\u2029")
        },
        createXhr: m.createXhr ||
        function() {
            var e, t, i;
            if ("undefined" != typeof XMLHttpRequest) return new XMLHttpRequest;
            if ("undefined" != typeof ActiveXObject) for (t = 0; 3 > t; t += 1) {
                i = r[t];
                try {
                    e = new ActiveXObject(i)
                } catch(n) {}
                if (e) {
                    r = [i];
                    break
                }
            }
            return e
        },
        parseName: function(e) {
            var t, i, n, o = !1,
            a = e.lastIndexOf("."),
            r = 0 === e.indexOf("./") || 0 === e.indexOf("../");
            return - 1 !== a && (!r || a > 1) ? (t = e.substring(0, a), i = e.substring(a + 1)) : t = e,
            n = i || t,
            a = n.indexOf("!"),
            -1 !== a && (o = "strip" === n.substring(a + 1), n = n.substring(0, a), i ? i = n: t = n),
            {
                moduleName: t,
                ext: i,
                strip: o
            }
        },
        xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
        useXhr: function(e, i, n, o) {
            var a, r, s, l = t.xdRegExp.exec(e);
            return l ? (a = l[2], r = l[3], r = r.split(":"), s = r[1], r = r[0], !(a && a !== i || r && r.toLowerCase() !== n.toLowerCase() || (s || r) && s !== o)) : !0
        },
        finishLoad: function(e, i, n, o) {
            n = i ? t.strip(n) : n,
            m.isBuild && (u[e] = n),
            o(n)
        },
        load: function(e, i, n, o) {
            if (o && o.isBuild && !o.inlineText) return void n();
            m.isBuild = o && o.isBuild;
            var a = t.parseName(e),
            r = a.moduleName + (a.ext ? "." + a.ext: ""),
            s = i.toUrl(r),
            l = m.useXhr || t.useXhr;
            return 0 === s.indexOf("empty:") ? void n() : void(!d || l(s, c, p, h) ? t.get(s,
            function(i) {
                t.finishLoad(e, a.strip, i, n)
            },
            function(e) {
                n.error && n.error(e)
            }) : i([r],
            function(e) {
                t.finishLoad(a.moduleName + "." + a.ext, a.strip, e, n)
            }))
        },
        write: function(e, i, n, o) {
            if (u.hasOwnProperty(i)) {
                var a = t.jsEscape(u[i]);
                n.asModule(e + "!" + i, "define(function () { return '" + a + "';});\n")
            }
        },
        writeFile: function(e, i, n, o, a) {
            var r = t.parseName(i),
            s = r.ext ? "." + r.ext: "",
            l = r.moduleName + s,
            d = n.toUrl(r.moduleName + s) + ".js";
            t.load(l, n,
            function(i) {
                var n = function(e) {
                    return o(d, e)
                };
                n.asModule = function(e, t) {
                    return o.asModule(e, d, t)
                },
                t.write(e, l, n, a)
            },
            a)
        }
    },
    "node" === m.env || !m.env && "undefined" != typeof process && process.versions && process.versions.node && !process.versions["node-webkit"] && !process.versions["atom-shell"] ? (i = require.nodeRequire("fs"), t.get = function(e, t, n) {
        try {
            var o = i.readFileSync(e, "utf8");
            "\ufeff" === o[0] && (o = o.substring(1)),
            t(o)
        } catch(a) {
            n && n(a)
        }
    }) : "xhr" === m.env || !m.env && t.createXhr() ? t.get = function(e, i, n, o) {
        var a, r = t.createXhr();
        if (r.open("GET", e, !0), o) for (a in o) o.hasOwnProperty(a) && r.setRequestHeader(a.toLowerCase(), o[a]);
        m.onXhr && m.onXhr(r, e),
        r.onreadystatechange = function(t) {
            var o, a;
            4 === r.readyState && (o = r.status || 0, o > 399 && 600 > o ? (a = new Error(e + " HTTP status: " + o), a.xhr = r, n && n(a)) : i(r.responseText), m.onXhrComplete && m.onXhrComplete(r, e))
        },
        r.send(null)
    }: "rhino" === m.env || !m.env && "undefined" != typeof Packages && "undefined" != typeof java ? t.get = function(e, t) {
        var i, n, o = "utf-8",
        a = new java.io.File(e),
        r = java.lang.System.getProperty("line.separator"),
        s = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(a), o)),
        l = "";
        try {
            for (i = new java.lang.StringBuffer, n = s.readLine(), n && n.length() && 65279 === n.charAt(0) && (n = n.substring(1)), null !== n && i.append(n); null !== (n = s.readLine());) i.append(r),
            i.append(n);
            l = String(i.toString())
        } finally {
            s.close()
        }
        t(l)
    }: ("xpconnect" === m.env || !m.env && "undefined" != typeof Components && Components.classes && Components.interfaces) && (n = Components.classes, o = Components.interfaces, Components.utils["import"]("resource://gre/modules/FileUtils.jsm"), a = "@mozilla.org/windows-registry-key;1" in n, t.get = function(e, t) {
        var i, r, s, l = {};
        a && (e = e.replace(/\//g, "\\")),
        s = new FileUtils.File(e);
        try {
            i = n["@mozilla.org/network/file-input-stream;1"].createInstance(o.nsIFileInputStream),
            i.init(s, 1, 0, !1),
            r = n["@mozilla.org/intl/converter-input-stream;1"].createInstance(o.nsIConverterInputStream),
            r.init(i, "utf-8", i.available(), o.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),
            r.readString(i.available(), l),
            r.close(),
            i.close(),
            t(l.value)
        } catch(d) {
            throw new Error((s && s.path || "") + ": " + d)
        }
    }),
    t
}),
define("text!app/common/tpl/page.html", [],
function() {
    return '<div id="header"></div>\n<div id="content"></div>\n<div id="navigation"></div>'
}),
define("app/common/view/page", ["underscore", "marionette", "text!app/common/tpl/page.html"],
function(e, t, i) {
    "use strict";
    var n = t.LayoutView.extend({
        className: "page",
        template: e.template(i),
        regions: {
            header: "#header",
            content: "#content",
            navigation: "#navigation"
        },
        initialize: function(t) {
            e.extend(this, t)
        },
        isTopPage: function() {
            return !! this.topPage
        }
    });
    return n
}),
define("text!app/common/tpl/navigation.html", [],
function() {
    return '<ul class="tabs justified tabs-icon-top">\n  <li data-role="product"><a class="tab-item" href="<%= ctx %>/products" data-gta="event" data-category="f_products_list" data-action="click" data-label="进入产品列表页"><i class="icon icon-food"></i>美食</a></li>\n  <li data-role="banquet"><a class="tab-item" href="<%= ctx %>/hotels?businessType=banquet" data-gta="event" data-category="f_banquet_list" data-action="click" data-label="进入宴会列表页"><i class="icon icon-banquet"></i>宴会</a></li>\n  <li data-role="meeting"><a class="tab-item" href="<%= ctx %>/hotels?businessType=meeting" data-gta="event" data-category="f_meeting_list" data-action="click" data-label="进入会务列表页"><i class="icon icon-meeting"></i>会务</a></li>\n  <li data-role="profile"><a class="tab-item" href="<%= ctx %>/profile" data-gta="event" data-category="f_profile" data-action="click" data-label="进入个人中心页"><i class="icon icon-profile"></i>我</a></li>\n</ul>'
}),
define("app/common/view/navigation", ["underscore", "marionette", "app/application", "text!app/common/tpl/navigation.html"],
function(e, t, i, n) {
    "use strict";
    var o = t.ItemView.extend({
        tagName: "footer",
        className: "bar footer fixed-bottom xdd-footer",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx
            }
        },
        initialize: function() {
            i.commands.setHandler("navigation:active", e.bind(function(e) {
                this.$("li.active").removeClass("active"),
                this.$('[data-role="' + e + '"]').addClass("active")
            },
            this))
        }
    });
    return o
}),
define("text!app/common/tpl/loading.html", [],
function() {
    return '<div class="loader-inner ball-pulse-sync">\n  <div></div>\n  <div></div>\n  <div></div>\n</div>'
}),
define("app/common/view/loading", ["underscore", "marionette", "text!app/common/tpl/loading.html"],
function(e, t, i) {
    "use strict";
    var n = t.ItemView.extend({
        className: "page-loader",
        template: e.template(i)
    });
    return n
}),
define("text!app/common/tpl/selector.html", [],
function() {
    return '<ul class="tabs tabs-icon-aside justified no-divider no-padding-horizontal">\n  <li>\n    <a href="javascript: void(0)" class="tab-item" data-toggle="dropwizard" data-target="#city" data-drop="#drop">\n      <span>区域</span>&nbsp;<i class="icon icon-small icon-chevron-down"></i>\n    </a>\n  </li>\n  <li>\n    <a href="javascript: void(0)" class="tab-item" data-toggle="dropwizard" data-target="#category" data-drop="#drop">\n      <span>分类</span>&nbsp;<i class="icon icon-small icon-chevron-down"></i>\n    </a>\n  </li>\n  <li>\n    <a href="javascript: void(0)" class="tab-item" data-toggle="dropwizard" data-target="#orderby" data-drop="#drop">\n      <span>排序</span>&nbsp;<i class="icon icon-small icon-chevron-down"></i>\n    </a>\n  </li>\n</ul>\n<div class="menu-content">\n  <div id="city" class="dropwizard-menu <%= type === \'product\' ? \'\' : \'binary\' %>">\n    <% if (type === \'product\') { %>\n      <div class="menu">\n        <ul class="menu-list">\n          <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="cityCode" data-value="310100">上海全部</a></li>\n          <% _.each(districts[\'310100\'], function(district) { %>\n            <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="districtCode" data-value="<%= district.code %>"><%= district.name %></a></li>\n          <% }) %>\n        </ul>\n      </div>\n    <% } else { %>\n      <div class="menu">\n        <ul class="menu-list">\n          <% _.each(cities, function(city) { %>\n            <li><a href="javascript: void(0)" data-direct="#city<%= city.code %>"><%= city.name %></a></li>\n          <% }) %>\n        </ul>\n      </div>\n      <% _.each(cities, function(city) { %>\n        <div class="menu" id="city<%= city.code %>">\n          <ul class="menu-list">\n            <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="cityCode" data-value="<%= city.code %>"><%= city.name.substring(0, city.name.length - 1) + "全部" %></a></li>\n            <% _.each(districts[city.code], function(district) { %>\n              <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="districtCode" data-value="<%= district.code %>"><%= district.name %></a></li>\n            <% }) %>\n          </ul>\n        </div>\n      <% }) %>\n    <% } %>\n  </div>\n  <div id="category" class="dropwizard-menu">\n    <div class="menu">\n      <ul class="menu-list">\n        <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="categoryId" data-value="">不限</a></li>\n        <% _.each(categories, function(category) { %>\n          <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="categoryId" data-value="<%= category.id %>"><%= category.displayName %></a></li>\n        <% }) %>\n      </ul>\n    </div>\n  </div>\n  <div id="orderby" class="dropwizard-menu">\n    <div class="menu">\n      <ul class="menu-list">\n        <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="" data-value="">默认排序</a></li>\n        <% _.each(orderbys, function(orderby) { %>\n          <li><a href="javascript: void(0)" data-confirm="dropwizard" data-code="<%= orderby.code %>" data-value="<%= orderby.value %>"><%= orderby.description %></a></li>\n        <% }) %>\n      </ul>\n    </div>\n  </div>\n</div>'
}),
function(e, t, i) {
    function n(e, i) {
        this.wrapper = "string" == typeof e ? t.querySelector(e) : e,
        this.scroller = this.wrapper.children[0],
        this.scrollerStyle = this.scroller.style,
        this.options = {
            startX: 0,
            startY: 0,
            scrollY: !0,
            directionLockThreshold: 5,
            momentum: !0,
            bounce: !0,
            bounceTime: 600,
            bounceEasing: "",
            preventDefault: !0,
            preventDefaultException: {
                tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/
            },
            HWCompositing: !0,
            useTransition: !0,
            useTransform: !0
        };
        for (var n in i) this.options[n] = i[n];
        this.translateZ = this.options.HWCompositing && a.hasPerspective ? " translateZ(0)": "",
        this.options.useTransition = a.hasTransition && this.options.useTransition,
        this.options.useTransform = a.hasTransform && this.options.useTransform,
        this.options.eventPassthrough = this.options.eventPassthrough === !0 ? "vertical": this.options.eventPassthrough,
        this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault,
        this.options.scrollY = "vertical" == this.options.eventPassthrough ? !1 : this.options.scrollY,
        this.options.scrollX = "horizontal" == this.options.eventPassthrough ? !1 : this.options.scrollX,
        this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough,
        this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold,
        this.options.bounceEasing = "string" == typeof this.options.bounceEasing ? a.ease[this.options.bounceEasing] || a.ease.circular: this.options.bounceEasing,
        this.options.resizePolling = void 0 === this.options.resizePolling ? 60 : this.options.resizePolling,
        this.options.tap === !0 && (this.options.tap = "tap"),
        this.x = 0,
        this.y = 0,
        this.directionX = 0,
        this.directionY = 0,
        this._events = {},
        this._init(),
        this.refresh(),
        this.scrollTo(this.options.startX, this.options.startY),
        this.enable()
    }
    var o = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame ||
    function(t) {
        e.setTimeout(t, 1e3 / 60)
    },
    a = function() {
        function n(e) {
            return r === !1 ? !1 : "" === r ? e: r + e.charAt(0).toUpperCase() + e.substr(1)
        }
        var o = {},
        a = t.createElement("div").style,
        r = function() {
            for (var e, t = ["t", "webkitT", "MozT", "msT", "OT"], i = 0, n = t.length; n > i; i++) if (e = t[i] + "ransform", e in a) return t[i].substr(0, t[i].length - 1);
            return ! 1
        } ();
        o.getTime = Date.now ||
        function() {
            return (new Date).getTime()
        },
        o.extend = function(e, t) {
            for (var i in t) e[i] = t[i]
        },
        o.addEvent = function(e, t, i, n) {
            e.addEventListener(t, i, !!n)
        },
        o.removeEvent = function(e, t, i, n) {
            e.removeEventListener(t, i, !!n)
        },
        o.prefixPointerEvent = function(t) {
            return e.MSPointerEvent ? "MSPointer" + t.charAt(9).toUpperCase() + t.substr(10) : t
        },
        o.momentum = function(e, t, n, o, a, r) {
            var s, l, d = e - t,
            c = i.abs(d) / n;
            return r = void 0 === r ? 6e-4: r,
            s = e + c * c / (2 * r) * (0 > d ? -1 : 1),
            l = c / r,
            o > s ? (s = a ? o - a / 2.5 * (c / 8) : o, d = i.abs(s - e), l = d / c) : s > 0 && (s = a ? a / 2.5 * (c / 8) : 0, d = i.abs(e) + s, l = d / c),
            {
                destination: i.round(s),
                duration: l
            }
        };
        var s = n("transform");
        return o.extend(o, {
            hasTransform: s !== !1,
            hasPerspective: n("perspective") in a,
            hasTouch: "ontouchstart" in e,
            hasPointer: e.PointerEvent || e.MSPointerEvent,
            hasTransition: n("transition") in a
        }),
        o.isBadAndroid = /Android /.test(e.navigator.appVersion) && !/Chrome\/\d/.test(e.navigator.appVersion),
        o.extend(o.style = {},
        {
            transform: s,
            transitionTimingFunction: n("transitionTimingFunction"),
            transitionDuration: n("transitionDuration"),
            transitionDelay: n("transitionDelay"),
            transformOrigin: n("transformOrigin")
        }),
        o.hasClass = function(e, t) {
            var i = new RegExp("(^|\\s)" + t + "(\\s|$)");
            return i.test(e.className)
        },
        o.addClass = function(e, t) {
            if (!o.hasClass(e, t)) {
                var i = e.className.split(" ");
                i.push(t),
                e.className = i.join(" ")
            }
        },
        o.removeClass = function(e, t) {
            if (o.hasClass(e, t)) {
                var i = new RegExp("(^|\\s)" + t + "(\\s|$)", "g");
                e.className = e.className.replace(i, " ")
            }
        },
        o.offset = function(e) {
            for (var t = -e.offsetLeft,
            i = -e.offsetTop; e = e.offsetParent;) t -= e.offsetLeft,
            i -= e.offsetTop;
            return {
                left: t,
                top: i
            }
        },
        o.preventDefaultException = function(e, t) {
            for (var i in t) if (t[i].test(e[i])) return ! 0;
            return ! 1
        },
        o.extend(o.eventType = {},
        {
            touchstart: 1,
            touchmove: 1,
            touchend: 1,
            mousedown: 2,
            mousemove: 2,
            mouseup: 2,
            pointerdown: 3,
            pointermove: 3,
            pointerup: 3,
            MSPointerDown: 3,
            MSPointerMove: 3,
            MSPointerUp: 3
        }),
        o.extend(o.ease = {},
        {
            quadratic: {
                style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
                fn: function(e) {
                    return e * (2 - e)
                }
            },
            circular: {
                style: "cubic-bezier(0.1, 0.57, 0.1, 1)",
                fn: function(e) {
                    return i.sqrt(1 - --e * e)
                }
            },
            back: {
                style: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
                fn: function(e) {
                    var t = 4;
                    return (e -= 1) * e * ((t + 1) * e + t) + 1
                }
            },
            bounce: {
                style: "",
                fn: function(e) {
                    return (e /= 1) < 1 / 2.75 ? 7.5625 * e * e: 2 / 2.75 > e ? 7.5625 * (e -= 1.5 / 2.75) * e + .75 : 2.5 / 2.75 > e ? 7.5625 * (e -= 2.25 / 2.75) * e + .9375 : 7.5625 * (e -= 2.625 / 2.75) * e + .984375
                }
            },
            elastic: {
                style: "",
                fn: function(e) {
                    var t = .22,
                    n = .4;
                    return 0 === e ? 0 : 1 == e ? 1 : n * i.pow(2, -10 * e) * i.sin((e - t / 4) * (2 * i.PI) / t) + 1
                }
            }
        }),
        o.tap = function(e, i) {
            var n = t.createEvent("Event");
            n.initEvent(i, !0, !0),
            n.pageX = e.pageX,
            n.pageY = e.pageY,
            e.target.dispatchEvent(n)
        },
        o.click = function(e) {
            var i, n = e.target;
            /(SELECT|INPUT|TEXTAREA)/i.test(n.tagName) || (i = t.createEvent("MouseEvents"), i.initMouseEvent("click", !0, !0, e.view, 1, n.screenX, n.screenY, n.clientX, n.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, 0, null), i._constructed = !0, n.dispatchEvent(i))
        },
        o
    } ();
    n.prototype = {
        version: "5.1.3",
        _init: function() {
            this._initEvents()
        },
        destroy: function() {
            this._initEvents(!0),
            this._execEvent("destroy")
        },
        _transitionEnd: function(e) {
            e.target == this.scroller && this.isInTransition && (this._transitionTime(), this.resetPosition(this.options.bounceTime) || (this.isInTransition = !1, this._execEvent("scrollEnd")))
        },
        _start: function(e) {
            if ((1 == a.eventType[e.type] || 0 === e.button) && this.enabled && (!this.initiated || a.eventType[e.type] === this.initiated)) { ! this.options.preventDefault || a.isBadAndroid || a.preventDefaultException(e.target, this.options.preventDefaultException) || e.preventDefault();
                var t, n = e.touches ? e.touches[0] : e;
                this.initiated = a.eventType[e.type],
                this.moved = !1,
                this.distX = 0,
                this.distY = 0,
                this.directionX = 0,
                this.directionY = 0,
                this.directionLocked = 0,
                this._transitionTime(),
                this.startTime = a.getTime(),
                this.options.useTransition && this.isInTransition ? (this.isInTransition = !1, t = this.getComputedPosition(), this._translate(i.round(t.x), i.round(t.y)), this._execEvent("scrollEnd")) : !this.options.useTransition && this.isAnimating && (this.isAnimating = !1, this._execEvent("scrollEnd")),
                this.startX = this.x,
                this.startY = this.y,
                this.absStartX = this.x,
                this.absStartY = this.y,
                this.pointX = n.pageX,
                this.pointY = n.pageY,
                this._execEvent("beforeScrollStart")
            }
        },
        _move: function(e) {
            if (this.enabled && a.eventType[e.type] === this.initiated) {
                this.options.preventDefault && e.preventDefault();
                var t, n, o, r, s = e.touches ? e.touches[0] : e,
                l = s.pageX - this.pointX,
                d = s.pageY - this.pointY,
                c = a.getTime();
                if (this.pointX = s.pageX, this.pointY = s.pageY, this.distX += l, this.distY += d, o = i.abs(this.distX), r = i.abs(this.distY), !(c - this.endTime > 300 && 10 > o && 10 > r)) {
                    if (this.directionLocked || this.options.freeScroll || (o > r + this.options.directionLockThreshold ? this.directionLocked = "h": r >= o + this.options.directionLockThreshold ? this.directionLocked = "v": this.directionLocked = "n"), "h" == this.directionLocked) {
                        if ("vertical" == this.options.eventPassthrough) e.preventDefault();
                        else if ("horizontal" == this.options.eventPassthrough) return void(this.initiated = !1);
                        d = 0
                    } else if ("v" == this.directionLocked) {
                        if ("horizontal" == this.options.eventPassthrough) e.preventDefault();
                        else if ("vertical" == this.options.eventPassthrough) return void(this.initiated = !1);
                        l = 0
                    }
                    l = this.hasHorizontalScroll ? l: 0,
                    d = this.hasVerticalScroll ? d: 0,
                    t = this.x + l,
                    n = this.y + d,
                    (t > 0 || t < this.maxScrollX) && (t = this.options.bounce ? this.x + l / 3 : t > 0 ? 0 : this.maxScrollX),
                    (n > 0 || n < this.maxScrollY) && (n = this.options.bounce ? this.y + d / 3 : n > 0 ? 0 : this.maxScrollY),
                    this.directionX = l > 0 ? -1 : 0 > l ? 1 : 0,
                    this.directionY = d > 0 ? -1 : 0 > d ? 1 : 0,
                    this.moved || this._execEvent("scrollStart"),
                    this.moved = !0,
                    this._translate(t, n),
                    c - this.startTime > 300 && (this.startTime = c, this.startX = this.x, this.startY = this.y)
                }
            }
        },
        _end: function(e) {
            if (this.enabled && a.eventType[e.type] === this.initiated) {
                this.options.preventDefault && !a.preventDefaultException(e.target, this.options.preventDefaultException) && e.preventDefault();
                var t, n, o = (e.changedTouches ? e.changedTouches[0] : e, a.getTime() - this.startTime),
                r = i.round(this.x),
                s = i.round(this.y),
                l = i.abs(r - this.startX),
                d = i.abs(s - this.startY),
                c = 0,
                p = "";
                if (this.isInTransition = 0, this.initiated = 0, this.endTime = a.getTime(), !this.resetPosition(this.options.bounceTime)) return this.scrollTo(r, s),
                this.moved ? this._events.flick && 200 > o && 100 > l && 100 > d ? void this._execEvent("flick") : (this.options.momentum && 300 > o && (t = this.hasHorizontalScroll ? a.momentum(this.x, this.startX, o, this.maxScrollX, this.options.bounce ? this.wrapperWidth: 0, this.options.deceleration) : {
                    destination: r,
                    duration: 0
                },
                n = this.hasVerticalScroll ? a.momentum(this.y, this.startY, o, this.maxScrollY, this.options.bounce ? this.wrapperHeight: 0, this.options.deceleration) : {
                    destination: s,
                    duration: 0
                },
                r = t.destination, s = n.destination, c = i.max(t.duration, n.duration), this.isInTransition = 1), r != this.x || s != this.y ? ((r > 0 || r < this.maxScrollX || s > 0 || s < this.maxScrollY) && (p = a.ease.quadratic), void this.scrollTo(r, s, c, p)) : void this._execEvent("scrollEnd")) : (this.options.tap && a.tap(e, this.options.tap), this.options.click && a.click(e), void this._execEvent("scrollCancel"))
            }
        },
        _resize: function() {
            var e = this;
            clearTimeout(this.resizeTimeout),
            this.resizeTimeout = setTimeout(function() {
                e.refresh()
            },
            this.options.resizePolling)
        },
        resetPosition: function(e) {
            var t = this.x,
            i = this.y;
            return e = e || 0,
            !this.hasHorizontalScroll || this.x > 0 ? t = 0 : this.x < this.maxScrollX && (t = this.maxScrollX),
            !this.hasVerticalScroll || this.y > 0 ? i = 0 : this.y < this.maxScrollY && (i = this.maxScrollY),
            t == this.x && i == this.y ? !1 : (this.scrollTo(t, i, e, this.options.bounceEasing), !0)
        },
        disable: function() {
            this.enabled = !1
        },
        enable: function() {
            this.enabled = !0
        },
        refresh: function() {
            this.wrapper.offsetHeight;
            this.wrapperWidth = this.wrapper.clientWidth,
            this.wrapperHeight = this.wrapper.clientHeight,
            this.scrollerWidth = this.scroller.offsetWidth,
            this.scrollerHeight = this.scroller.offsetHeight,
            this.maxScrollX = this.wrapperWidth - this.scrollerWidth,
            this.maxScrollY = this.wrapperHeight - this.scrollerHeight,
            this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0,
            this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0,
            this.hasHorizontalScroll || (this.maxScrollX = 0, this.scrollerWidth = this.wrapperWidth),
            this.hasVerticalScroll || (this.maxScrollY = 0, this.scrollerHeight = this.wrapperHeight),
            this.endTime = 0,
            this.directionX = 0,
            this.directionY = 0,
            this.wrapperOffset = a.offset(this.wrapper),
            this._execEvent("refresh"),
            this.resetPosition()
        },
        on: function(e, t) {
            this._events[e] || (this._events[e] = []),
            this._events[e].push(t)
        },
        off: function(e, t) {
            if (this._events[e]) {
                var i = this._events[e].indexOf(t);
                i > -1 && this._events[e].splice(i, 1)
            }
        },
        _execEvent: function(e) {
            if (this._events[e]) {
                var t = 0,
                i = this._events[e].length;
                if (i) for (; i > t; t++) this._events[e][t].apply(this, [].slice.call(arguments, 1))
            }
        },
        scrollBy: function(e, t, i, n) {
            e = this.x + e,
            t = this.y + t,
            i = i || 0,
            this.scrollTo(e, t, i, n)
        },
        scrollTo: function(e, t, i, n) {
            n = n || a.ease.circular,
            this.isInTransition = this.options.useTransition && i > 0,
            !i || this.options.useTransition && n.style ? (this._transitionTimingFunction(n.style), this._transitionTime(i), this._translate(e, t)) : this._animate(e, t, i, n.fn)
        },
        scrollToElement: function(e, t, n, o, r) {
            if (e = e.nodeType ? e: this.scroller.querySelector(e)) {
                var s = a.offset(e);
                s.left -= this.wrapperOffset.left,
                s.top -= this.wrapperOffset.top,
                n === !0 && (n = i.round(e.offsetWidth / 2 - this.wrapper.offsetWidth / 2)),
                o === !0 && (o = i.round(e.offsetHeight / 2 - this.wrapper.offsetHeight / 2)),
                s.left -= n || 0,
                s.top -= o || 0,
                s.left = s.left > 0 ? 0 : s.left < this.maxScrollX ? this.maxScrollX: s.left,
                s.top = s.top > 0 ? 0 : s.top < this.maxScrollY ? this.maxScrollY: s.top,
                t = void 0 === t || null === t || "auto" === t ? i.max(i.abs(this.x - s.left), i.abs(this.y - s.top)) : t,
                this.scrollTo(s.left, s.top, t, r)
            }
        },
        _transitionTime: function(e) {
            e = e || 0,
            this.scrollerStyle[a.style.transitionDuration] = e + "ms",
            !e && a.isBadAndroid && (this.scrollerStyle[a.style.transitionDuration] = "0.001s")
        },
        _transitionTimingFunction: function(e) {
            this.scrollerStyle[a.style.transitionTimingFunction] = e
        },
        _translate: function(e, t) {
            this.options.useTransform ? this.scrollerStyle[a.style.transform] = "translate(" + e + "px," + t + "px)" + this.translateZ: (e = i.round(e), t = i.round(t), this.scrollerStyle.left = e + "px", this.scrollerStyle.top = t + "px"),
            this.x = e,
            this.y = t
        },
        _initEvents: function(t) {
            var i = t ? a.removeEvent: a.addEvent,
            n = this.options.bindToWrapper ? this.wrapper: e;
            i(e, "orientationchange", this),
            i(e, "resize", this),
            this.options.click && i(this.wrapper, "click", this, !0),
            this.options.disableMouse || (i(this.wrapper, "mousedown", this), i(n, "mousemove", this), i(n, "mousecancel", this), i(n, "mouseup", this)),
            a.hasPointer && !this.options.disablePointer && (i(this.wrapper, a.prefixPointerEvent("pointerdown"), this), i(n, a.prefixPointerEvent("pointermove"), this), i(n, a.prefixPointerEvent("pointercancel"), this), i(n, a.prefixPointerEvent("pointerup"), this)),
            a.hasTouch && !this.options.disableTouch && (i(this.wrapper, "touchstart", this), i(n, "touchmove", this), i(n, "touchcancel", this), i(n, "touchend", this)),
            i(this.scroller, "transitionend", this),
            i(this.scroller, "webkitTransitionEnd", this),
            i(this.scroller, "oTransitionEnd", this),
            i(this.scroller, "MSTransitionEnd", this)
        },
        getComputedPosition: function() {
            var t, i, n = e.getComputedStyle(this.scroller, null);
            return this.options.useTransform ? (n = n[a.style.transform].split(")")[0].split(", "), t = +(n[12] || n[4]), i = +(n[13] || n[5])) : (t = +n.left.replace(/[^-\d.]/g, ""), i = +n.top.replace(/[^-\d.]/g, "")),
            {
                x: t,
                y: i
            }
        },
        _animate: function(e, t, i, n) {
            function r() {
                var h, u, m, f = a.getTime();
                return f >= p ? (s.isAnimating = !1, s._translate(e, t), void(s.resetPosition(s.options.bounceTime) || s._execEvent("scrollEnd"))) : (f = (f - c) / i, m = n(f), h = (e - l) * m + l, u = (t - d) * m + d, s._translate(h, u), void(s.isAnimating && o(r)))
            }
            var s = this,
            l = this.x,
            d = this.y,
            c = a.getTime(),
            p = c + i;
            this.isAnimating = !0,
            r()
        },
        handleEvent: function(e) {
            switch (e.type) {
            case "touchstart":
            case "pointerdown":
            case "MSPointerDown":
            case "mousedown":
                this._start(e);
                break;
            case "touchmove":
            case "pointermove":
            case "MSPointerMove":
            case "mousemove":
                this._move(e);
                break;
            case "touchend":
            case "pointerup":
            case "MSPointerUp":
            case "mouseup":
            case "touchcancel":
            case "pointercancel":
            case "MSPointerCancel":
            case "mousecancel":
                this._end(e);
                break;
            case "orientationchange":
            case "resize":
                this._resize();
                break;
            case "transitionend":
            case "webkitTransitionEnd":
            case "oTransitionEnd":
            case "MSTransitionEnd":
                this._transitionEnd(e);
                break;
            case "wheel":
            case "DOMMouseScroll":
            case "mousewheel":
                this._wheel(e);
                break;
            case "keydown":
                this._key(e);
                break;
            case "click":
                e._constructed || (e.preventDefault(), e.stopPropagation())
            }
        }
    },
    n.utils = a,
    "undefined" != typeof module && module.exports ? module.exports = n: e.IScroll = n
} (window, document, Math),
define("iscroll",
function(e) {
    return function() {
        var t;
        return t || e.IScroll
    }
} (this)),
function(e) {
    var t = "object" == typeof self && self.self === self && self;
    if ("function" == typeof define && define.amd) define("backdrop", ["jquery"],
    function(i) {
        return t.Backdrop = e(t, i)
    });
    else if ("undefined" != typeof exports) {
        var i = require("jquery");
        module.exports = e(t, i)
    } else t.Backdrop = e(t, t.jQuery || t.Zepto || t.$)
} (function(e, t) {
    "use strict";
    var i = function() {
        this.$body = t(document.body)
    };
    return i.prototype.open = function(e, i) {
        var n = t(e),
        o = n.hasClass("fade") ? "fade": "",
        a = t.support.transition && o;
        return this.$body.addClass("backdrop-open"),
        this.$element = t('<div class="backdrop ' + o + '"></div>').appendTo(t(document.body)),
        a && this.$element[0].offsetWidth,
        this.$element.addClass("in"),
        i ? (a ? this.$element.one(t.support.transition.end, i).emulateTransitionEnd(150) : i(), this) : this
    },
    i.prototype.close = function(e) {
        if (this.$element) {
            this.$body.removeClass("backdrop-open"),
            this.$element.removeClass("in");
            var i = this,
            n = function() {
                i.removeBackdrop(),
                e && e()
            };
            t.support.transition && this.$element.hasClass("fade") ? this.$element.one(t.support.transition.end, n).emulateTransitionEnd(150) : n()
        }
        return this
    },
    i.prototype.removeBackdrop = function() {
        this.$element && this.$element.remove(),
        this.$element = null
    },
    i
}),
function(e, t) {
    if ("function" == typeof define && define.amd) define("dropwizard", ["jquery", "backdrop"], t);
    else if ("undefined" != typeof exports) {
        var i = require("jquery"),
        n = require("backdrop");
        t(i, n)
    } else t(e.Zepto || e.jQuery || e.$, e.Backdrop)
} (this,
function(e, t) {
    "use strict";

    function i(t) {
        return this.each(function() {
            var i = e(this),
            o = i.data("fancy:dropwizard"),
            a = e.extend({},
            n.DEFAULTS, i.data(), "object" == typeof t && t);
            o || i.data("fancy:dropwizard", o = new n(this, a)),
            "string" == typeof t ? o[t]() : o.toggle()
        })
    }
    var n = function(i, n) {
        this.$element = e(i),
        this.$target = e(this.$element.data("target") || this.$element.attr("href")),
        this.$drop = e(this.$element.data("drop")),
        this.$body = e(document.body),
        this.options = n,
        this.options.maxTextLength = 4,
        this.backdrop = new t,
        this.isShown = null,
        this.$target.on("tap.direct.fancy.dropwizard", "[data-direct]", e.proxy(this.direct, this)),
        this.$target.on("tap.confirm.fancy.dropwizard", "[data-confirm]", e.proxy(this.confirm, this))
    };
    n.DEFAULTS = {},
    n.prototype.toggle = function() {
        this.isShown ? this.hide() : this.show()
    },
    n.prototype.show = function() {
        var t = e.Event("show:fancy:dropwizard", {
            relatedTarget: this.$target[0]
        });
        if (this.$element.trigger(t), !this.isShown && !t.isDefaultPrevented()) {
            var i = this.$drop.find('.active > [data-toggle="dropwizard"]');
            i.length && i.dropwizard("hide");
            var n = this;
            this.isShown = !0,
            this.backdrop.open(this.$element[0],
            function() {
                n.$element.parent().addClass("active"),
                n.$target.addClass("active"),
                n.$element.trigger(e.Event("shown:fancy:dropwizard", {
                    relatedTarget: n.$target[0]
                }))
            })
        }
    },
    n.prototype.hide = function() {
        var t = e.Event("hide:fancy:dropwizard", {
            relatedTarget: this.$target[0]
        });
        if (this.$element.trigger(t), this.isShown && !t.isDefaultPrevented()) {
            this.isShown = !1,
            this.$element.parent().removeClass("active"),
            this.$target.removeClass("active");
            var i = this;
            this.backdrop.close(function() {
                i.$element.trigger("hidden:fancy:dropwizard", {
                    relatedTarget: i.$target
                })
            })
        }
    },
    n.prototype.direct = function(t) {
        t.preventDefault(),
        t.stopPropagation(),
        t.stopImmediatePropagation();
        var i = e(t.target),
        n = e(i.data("direct"));
        if (t = e.Event("direct:fancy:dropwizard", {
            relatedTarget: i[0]
        }), this.$element.trigger(t), !t.isDefaultPrevented() && !n.hasClass("active")) {
            var o = i.closest("ul"),
            a = o.find(".active");
            a.length && e(a.removeClass("active").children().data("direct")).removeClass("active"),
            i.parent().addClass("active"),
            n.addClass("active"),
            this.$element.trigger(e.Event("directed:fancy:dropwizard", {
                relatedTarget: i[0]
            }))
        }
    },
    n.prototype.confirm = function(t) {
        t.preventDefault(),
        t.stopPropagation(),
        t.stopImmediatePropagation();
        var i = e(t.target),
        n = i.text().trim();
        t = e.Event("confirm:fancy:dropwizard", {
            relatedTarget: t.target
        }),
        this.$element.trigger(t),
        t.isDefaultPrevented() || i.parent().hasClass("active") || (this.$target.find(".menu .active").each(function() {
            var t = e(this);
            if (t.children().data("confirm")) t.removeClass("active");
            else if (t.children().data("direct")) {
                var n = e(t.children().data("direct"));
                n[0] !== i.parents(".menu")[0] && (t.removeClass("active"), e(t.children().data("direct")).removeClass("active"))
            }
        }), i.parent().addClass("active"), this.$drop.find('.active > [data-toggle="dropwizard"] > span').text(n.length > this.options.maxTextLength ? n.substring(0, this.options.maxTextLength - 1) + "...": n), this.hide(), this.$element.trigger(e.Event("confirmed:fancy:dropwizard", {
            relatedTarget: i[0]
        })))
    },
    n.prototype.destroy = function() {
        this.isShown && this.hide(),
        this.$target.off(),
        this.backdrop = null
    };
    var o = e.fn.dropwizard;
    e.fn.dropwizard = i,
    e.fn.dropwizard.Constructor = n,
    e.fn.dropwizard.noConflict = function() {
        return e.fn.dropwizard = o,
        this
    }
}),
define("app/common/view/selector", ["jquery", "underscore", "backbone", "marionette", "app/application", "text!app/common/tpl/selector.html", "iscroll", "dropwizard"],
function(e, t, i, n, o, a, r) {
    "use strict";
    var s = i.Wreqr.radio.channel("persistent");
    return s.reqres.setHandler("cities:persistent",
    function() {
        var t = e.Deferred();
        return e.get(o.api + "/data/cities",
        function(e) {
            t.resolve(JSON.parse(e))
        }),
        t.promise()
    }),
    s.reqres.setHandler("districts:persistent",
    function() {
        var t = e.Deferred();
        return e.get(o.api + "/data/districts",
        function(e) {
            t.resolve(JSON.parse(e))
        }),
        t.promise()
    }),
    s.reqres.setHandler("product:categories:persistent",
    function() {
        var t = e.Deferred();
        return e.get(o.api + "/data/categories?type=product",
        function(e) {
            t.resolve(JSON.parse(e))
        }),
        t.promise()
    }),
    s.reqres.setHandler("hotel:categories:persistent",
    function() {
        var t = e.Deferred();
        return e.get(o.api + "/data/categories?type=hotel",
        function(e) {
            t.resolve(JSON.parse(e))
        }),
        t.promise()
    }),
    n.ItemView.extend({
        id: "drop",
        className: "top-selector dropwizard",
        template: t.template(a),
        serializeData: function() {
            return "product" === this.type && (this.orderbys = [{
                code: "orderByPrice",
                value: "1",
                description: "价格最低"
            },
            {
                code: "orderByPrice",
                value: "2",
                description: "价格最高"
            },
            {
                code: "orderBySales",
                value: "2",
                description: "销量最高"
            }]),
            {
                type: this.type,
                cities: this.cities,
                districts: this.districts,
                categories: this.categories,
                orderbys: this.orderbys
            }
        },
        ui: {
            wizard: '[data-toggle="dropwizard"]'
        },
        events: {
            "tap @ui.wizard": "onTapWizard",
            "shown:fancy:dropwizard @ui.wizard": "onShowWizard",
            "directed:fancy:dropwizard @ui.wizard": "onDirectWizard",
            "confirmed:fancy:dropwizard @ui.wizard": "onConfirmWizard"
        },
        initialize: function(e) {
            this.type = e.type,
            this.cities = e.cities,
            this.districts = e.districts,
            this.categories = e.categories,
            this.orderbys = e.orderbys
        },
        onTapWizard: function(t) {
            var i = t.target === t.currentTarget ? t.target: t.currentTarget,
            n = e(i);
            n.dropwizard()
        },
        onShowWizard: function(t) {
            var i = e(t.relatedTarget).children().first(),
            n = i.data("iscroll");
            n || i.data("iscroll", new r(i[0], {
                click: !0
            }))
        },
        onDirectWizard: function(t) {
            var i = e(e(t.relatedTarget).data("direct")),
            n = i.data("iscroll");
            n || i.data("iscroll", new r(i[0], {
                click: !0
            }))
        },
        onConfirmWizard: function(e) {
            var t = {
                code: e.relatedTarget.getAttribute("data-code"),
                value: e.relatedTarget.getAttribute("data-value")
            },
            n = i.Wreqr.radio.channel("selector").vent;
            n.trigger("change:selector", t)
        },
        onBeforeDestroy: function() {
            this.$el.find(".menu-content .menu").each(function() {
                var t = e(this),
                i = t.data("iscroll");
                i && (i.destroy(), t.data("iscroll", null))
            }),
            this.$el.find('[data-toggle="dropwizard"]').each(function() {
                e(this).dropwizard("destroy")
            })
        }
    })
}),
define("text!app/common/tpl/pageableview.html", [],
function() {
    return '<div class="list"></div>\n<p id="more" class="loading-more" href="javascript: void(0)">正在为您加载更多...</p>'
}),
define("app/common/view/pageableview", ["underscore", "backbone", "marionette", "app/application", "text!app/common/tpl/pageableview.html"],
function(e, t, i, n, o) {
    "use strict";
    var a = i.CompositeView.extend({
        className: "content",
        template: e.template(o),
        childViewContainer: ".list",
        collectionEvents: {
            sync: "onSyncCollection"
        },
        initialize: function() {
            this._isTicking = !1,
            this._threshold = 20,
            this.paginator = this.collection,
            this.collection = this.collection.fullCollection,
            $(window).on("scroll", $.proxy(this.requestScroll, this));
            var e = t.Wreqr.radio.channel("selector").vent;
            this.listenTo(e, "change:selector", this.onChangeSelecotr)
        },
        onShow: function() {
            n.commands.execute("layzr:refresh")
        },
        onAddChild: function() {
            n.commands.execute("layzr:refresh")
        },
        onSyncCollection: function() {
            this.paginator.hasNextPage() || this.$("#more").text("没有更多数据了")
        },
        onChangeSelecotr: function(e) {
            "districtCode" === e.code && (this.paginator.queryParams.cityCode = void 0),
            "cityCode" === e.code && (this.paginator.queryParams.districtCode = void 0),
            "orderBySales" === e.code && (this.paginator.queryParams.orderByPrice = void 0),
            "orderByPrice" === e.code && (this.paginator.queryParams.orderBySales = void 0),
            this.paginator.queryParams[e.code] = e.value || void 0,
            this.paginator.switchMode("infinite", {
                resetState: !0
            }),
            this.collection.reset(),
            this.paginator.getFirstPage({
                fetch: !0
            })
        },
        requestScroll: function() {
            this._lastScroll = window.scrollY || window.pageYOffset,
            this._isTicking || (requestAnimationFrame(e.bind(this.fetchMore, this)), this._isTicking = !0)
        },
        fetchMore: function() {
            this._isReadyToFetch() && this.paginator.hasNextPage() && this.paginator.getNextPage(),
            this._isTicking = !1
        },
        _isReadyToFetch: function() {
            var e = document.querySelector("#more"),
            t = this._lastScroll,
            i = t + window.innerHeight,
            n = this._getOffset(e),
            o = n + e.offsetHeight;
            return o >= t - this._threshold && n <= i + this._threshold
        },
        _getOffset: function(e) {
            return e.getBoundingClientRect().top + window.pageYOffset
        },
        onBeforeDestroy: function() {
            $(window).off("scroll", this.requestScroll)
        }
    });
    return a
}),
define("text!app/product/list/tpl/item.html", [],
function() {
    return '<div class="xdd-card-bg">\n  <img data-layzr="<%= res + \'/\' %><%= product.get(\'cover\') + \'!m.listcover.nw\' %>">\n</div>\n<a class="link" href="<%= ctx %>/products/<%= product.get(\'id\') %>" data-gta="event" data-category="f_products_detail" data-action="click" data-label="进入产品详情页"></a>\n<div class="xdd-info-card">\n  <h3 class="title"><%= product.get(\'name\') %></h3>\n  <p class="desc">\n    <%= product.get(\'description\') %>\n  </p>\n  <p class="price-interval clearfix">\n    \n    <span class="area"><%= product.get(\'tag\') %></span>\n    <span class="price"><%= (product.get(\'price\') / 100).toFixed(0) %><small>元</small></span>\n    \n  </p>\n</div>'
}),
define("app/product/list/view/item", ["app/application", "underscore", "marionette", "text!app/product/list/tpl/item.html"],
function(e, t, i, n) {
    "use strict";
    var o = i.ItemView.extend({
        className: "xdd-item-card",
        template: t.template(n),
        serializeData: function() {
            return {
                ctx: e.ctx,
                res: e.res,
                product: this.model
            }
        }
    });
    return o
}),
define("text!app/product/list/tpl/pageableview.html", [],
function() {
    return '<div class="xdd-banner">\n  <div id="islider-wrapper">\n  </div>\n</div>\n<div class="list"></div>\n<p id="more" class="loading-more" href="javascript: void(0)">正在为您加载更多...</p>'
}),
function() {
    var e, t, i, n, o, a;
    e = function() {
        var e = function(e) {
            if (!e.dom) throw new Error("dom element can not be empty!");
            if (!e.data || !e.data.length) throw new Error("data must be an array and must have more than one element!");
            this._opts = e,
            this._setting(),
            this._renderHTML(),
            this._bindHandler()
        };
        return e.prototype._setting = function() {
            var e = this._opts;
            this.wrap = e.dom,
            this.data = e.data,
            this.type = e.type || "pic",
            this.isVertical = e.isVertical || !1,
            this.isOverspread = e.isOverspread || !1,
            this.duration = e.duration || 2e3,
            this.initIndex = e.initIndex || 0,
            void 0 === e.fixPage ? this.fixPage = !0 : this.fixPage = e.fixPage,
            (this.initIndex > this.data.length - 1 || this.initIndex < 0) && (this.initIndex = 0),
            this.slideIndex = this.slideIndex || this.initIndex || 0,
            this.axis = this.isVertical ? "Y": "X",
            this.reverseAxis = "Y" === this.axis ? "X": "Y",
            this.width = this.wrap.clientWidth,
            this.height = this.wrap.clientHeight,
            this.ratio = this.height / this.width,
            this.scale = e.isVertical ? this.height: this.width,
            this.onslide = e.onslide,
            this.onslidestart = e.onslidestart,
            this.onslideend = e.onslideend,
            this.onslidechange = e.onslidechange,
            this.isLoading = e.isLoading,
            this.offset = this.offset || {
                X: 0,
                Y: 0
            },
            this.useZoom = e.useZoom || !1,
            this.data.length < 2 ? (this.isLooping = !1, this.isAutoPlay = !1) : (this.isLooping = e.isLooping || !1, this.isAutoplay = e.isAutoplay || !1),
            "card" === e.animateType && this.isVertical && (this.isOverspread = !0),
            this.isAutoplay && this.play(),
            this.useZoom && this._initZoom(e),
            this.log = e.isDebug ?
            function(e) {
                window.console.log(e)
            }: function() {},
            this._setUpDamping(),
            this._setPlayWhenFocus(),
            this._animateFunc = e.animateType in this._animateFuncs ? this._animateFuncs[e.animateType] : this._animateFuncs["default"]
        },
        e.prototype._setPlayWhenFocus = function() {
            window.addEventListener("focus", this, !1),
            window.addEventListener("blur", this, !1)
        },
        e.prototype._animateFuncs = {
            "default": function(e, t, i, n, o) {
                e.style.webkitTransform = "translateZ(0) translate" + t + "(" + (o + i * (n - 1)) + "px)"
            }
        },
        e.prototype._setUpDamping = function() {
            var e = this.scale >> 1,
            t = e >> 1,
            i = t >> 2;
            this._damping = function(n) {
                var o, a = Math.abs(n);
                return o = e > a ? a >> 1 : e + t > a ? t + (a - e >> 2) : t + i + (a - e - t >> 3),
                n > 0 ? o: -o
            }
        },
        e.prototype._renderItem = function(e, t) {
            var i, n, o = this.data.length,
            a = this,
            r = function() {
                n = i.height / i.width > a.ratio ? '<img height="' + a.height + '" src="' + i.content + '">': '<img width="' + a.width + '" src="' + i.content + '">',
                e.innerHTML = n
            };
            if (i = this.isLooping ? 0 > t ? this.data[o + t] : t > o - 1 ? this.data[t - o] : this.data[t] : this.data[t] || {
                empty: !0
            },
            i.empty) return e.innerHTML = "",
            void(e.style.background = "");
            if ("pic" === this.type) if (this.isOverspread) e.style.background = "url(" + i.content + ") 50% 50% no-repeat",
            e.style.backgroundSize = "cover";
            else if (i.height & i.width) r();
            else {
                var s = new Image;
                s.src = i.content,
                s.onload = function() {
                    i.height = s.height,
                    i.width = s.width,
                    r()
                }
            } else "dom" === this.type && (e.innerHTML = i.content)
        },
        e.prototype._renderHTML = function() {
            this.outer && (this.outer.innerHTML = "");
            var e = this.outer || document.createElement("ul");
            if (e.className = "islider-outer", e.style.cssText = "height:" + this.height + "px;width:" + this.width + "px;margin:0;padding:0;list-style:none;", "pic" === this.type && !this.loader && this.isLoading) {
                var t = document.createElement("div");
                t.className = "islider-loader",
                this.loader = t,
                this.wrap.appendChild(t)
            }
            this.els = [];
            for (var i = 0; 3 > i; i++) {
                var n = document.createElement("li");
                n.className = "dom" === this.type ? "islider-dom": "islider-pic",
                n.style.cssText = "height:" + this.height + "px;width:" + this.width + "px;",
                this.els.push(n),
                this._animateFunc(n, this.axis, this.scale, i, 0),
                !this.isVertical || "rotate" !== this._opts.animateType && "flip" !== this._opts.animateType ? this._renderItem(n, i - 1 + this.slideIndex) : this._renderItem(n, 1 - i + this.slideIndex),
                e.appendChild(n)
            }
            this._initLoadImg(),
            this.outer || (this.outer = e, this.wrap.appendChild(e))
        },
        e.prototype._preloadImg = function(e) {
            var t = this.data.length,
            i = e,
            n = this,
            o = function(e) {
                if (e > -1 && !n.data[e].loaded) {
                    var t = new Image;
                    t.src = n.data[e].content,
                    t.onload = function() {
                        n.data[e].width = t.width,
                        n.data[e].height = t.height
                    },
                    n.data[e].loaded = 1
                }
            };
            if ("dom" !== n.type && t > 3) {
                var a = i + 2 > t - 1 ? (i + 2) % t: i + 2,
                r = 0 > i - 2 ? t - 2 + i: i - 2;
                o(a),
                o(r)
            }
        },
        e.prototype._initLoadImg = function() {
            var e = this.data,
            t = e.length,
            i = this.slideIndex,
            n = this;
            if ("dom" !== this.type && t > 3) {
                var o = i + 2 > t ? (i + 1) % t: i + 1,
                a = 0 > i - 1 ? t - 1 + i: i - 1;
                e[i].loaded = 1,
                e[o].loaded = 1,
                n.isLooping && (e[a].loaded = 1),
                setTimeout(function() {
                    n._preloadImg(i)
                },
                200)
            }
        },
        e.prototype.slideTo = function(e) {
            var t = this.data,
            i = this.els,
            n = e,
            o = e - this.slideIndex;
            if (Math.abs(o) > 1) {
                var a = o > 0 ? this.els[2] : this.els[0];
                this._renderItem(a, n)
            }
            this._preloadImg(n),
            t[n] ? this.slideIndex = n: this.isLooping ? this.slideIndex = o > 0 ? 0 : t.length - 1 : (this.slideIndex = this.slideIndex, o = 0),
            this.log("pic idx:" + this.slideIndex);
            var r; ! this.isVertical || "rotate" !== this._opts.animateType && "flip" !== this._opts.animateType ? o > 0 ? (r = i.shift(), i.push(r)) : 0 > o && (r = i.pop(), i.unshift(r)) : o > 0 ? (r = i.pop(), i.unshift(r)) : 0 > o && (r = i.shift(), i.push(r)),
            0 !== o && (Math.abs(o) > 1 ? (this._renderItem(i[0], n - 1), this._renderItem(i[2], n + 1)) : 1 === Math.abs(o) && this._renderItem(r, n + o), r.style.webkitTransition = "none", r.style.visibility = "hidden", setTimeout(function() {
                r.style.visibility = "visible"
            },
            200), this.onslidechange && this.onslidechange(this.slideIndex), this.dotchange && this.dotchange());
            for (var s = 0; 3 > s; s++) i[s] !== r && (i[s].style.webkitTransition = "all .3s ease"),
            this._animateFunc(i[s], this.axis, this.scale, s, 0);
            this.isAutoplay && !this.isLooping && this.slideIndex === t.length - 1 && this.pause()
        },
        e.prototype._device = function() {
            var e = !!("ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch),
            t = e ? "touchstart": "mousedown",
            i = e ? "touchmove": "mousemove",
            n = e ? "touchend": "mouseup";
            return {
                hasTouch: e,
                startEvt: t,
                moveEvt: i,
                endEvt: n
            }
        },
        e.prototype._bindHandler = function() {
            var e = this.outer,
            t = this._device();
            t.hasTouch || (e.style.cursor = "pointer", e.ondragstart = function(e) {
                return e ? !1 : !0
            }),
            e.addEventListener(t.startEvt, this),
            e.addEventListener(t.moveEvt, this),
            e.addEventListener(t.endEvt, this),
            window.addEventListener("orientationchange", this)
        },
        e.prototype.bind = e.prototype.delegate = function(e, t, i) {
            function n(e) {
                for (var n = window.event ? window.event: e, o = n.target, a = document.querySelectorAll(t), r = 0; r < a.length; r++) if (o === a[r]) {
                    i.call(o);
                    break
                }
            }
            this.wrap.addEventListener(e, n, !1)
        },
        e.prototype.destroy = function() {
            var e = this.outer,
            t = this._device();
            e.removeEventListener(t.startEvt, this),
            e.removeEventListener(t.moveEvt, this),
            e.removeEventListener(t.endEvt, this),
            window.removeEventListener("orientationchange", this),
            window.removeEventListener("focus", this),
            window.removeEventListener("blur", this),
            this.wrap.innerHTML = ""
        },
        e.prototype.handleEvent = function(e) {
            var t = this._device();
            switch (e.type) {
            case t.startEvt:
                this.startHandler(e);
                break;
            case t.moveEvt:
                this.moveHandler(e);
                break;
            case t.endEvt:
                this.endHandler(e);
                break;
            case "touchcancel":
                this.endHandler(e);
                break;
            case "orientationchange":
                this.orientationchangeHandler();
                break;
            case "focus":
                this.isAutoplay && this.play();
                break;
            case "blur":
                this.pause()
            }
        },
        e.prototype.startHandler = function(e) {
            if (this.fixPage) {
                var t = e.target;
                "SELECT" !== t.tagName && "INPUT" !== t.tagName && "TEXTAREA" !== t.tagName && e.preventDefault()
            }
            var i = this._device();
            this.isMoving = !0,
            this.pause(),
            this.onslidestart && this.onslidestart(),
            this.log("Event: beforeslide"),
            this.startTime = (new Date).getTime(),
            this.startX = i.hasTouch ? e.targetTouches[0].pageX: e.pageX,
            this.startY = i.hasTouch ? e.targetTouches[0].pageY: e.pageY,
            this._startHandler && this._startHandler(e)
        },
        e.prototype.moveHandler = function(e) {
            if (this.isMoving) {
                var t = this._device(),
                i = this.data.length,
                n = this.axis,
                o = this.reverseAxis,
                a = {
                    X: t.hasTouch ? e.targetTouches[0].pageX - this.startX: e.pageX - this.startX,
                    Y: t.hasTouch ? e.targetTouches[0].pageY - this.startY: e.pageY - this.startY
                },
                r = this._moveHandler ? this._moveHandler(e) : !1;
                if (!r && Math.abs(a[n]) - Math.abs(a[o]) > 10) {
                    e.preventDefault(),
                    this.onslide && this.onslide(a[n]),
                    this.log("Event: onslide"),
                    this.isLooping || (a[n] > 0 && 0 === this.slideIndex || a[n] < 0 && this.slideIndex === i - 1) && (a[n] = this._damping(a[n]));
                    for (var s = 0; 3 > s; s++) {
                        var l = this.els[s];
                        l.style.webkitTransition = "all 0s",
                        this._animateFunc(l, n, this.scale, s, a[n])
                    }
                }
                this.offset = a
            }
        },
        e.prototype.endHandler = function(e) {
            this.isMoving = !1;
            var t = this.offset,
            i = this.axis,
            n = this.scale / 2,
            o = (new Date).getTime();
            n = o - this.startTime > 300 ? n: 14;
            var a = this._endHandler ? this._endHandler(e) : !1,
            r = Math.abs(t[i]),
            s = Math.abs(t[this.reverseAxis]),
            l = function(e) {
                if ("A" === e.tagName) {
                    if (e.href) return window.location.href = e.href,
                    !1
                } else {
                    if ("islider-dom" === e.className) return ! 1;
                    l(e.parentNode)
                }
            }; ! a && t[i] >= n && r > s ? this.slideTo(this.slideIndex - 1) : !a && t[i] < -n && r > s ? this.slideTo(this.slideIndex + 1) : a || this.slideTo(this.slideIndex),
            Math.abs(this.offset.X) < 10 && Math.abs(this.offset.Y) < 10 && (this.tapEvt = document.createEvent("Event"), this.tapEvt.initEvent("tap", !0, !0), this.fixPage && "dom" === this.type && l(e.target), e.target.dispatchEvent(this.tapEvt) || e.preventDefault()),
            this.offset.X = this.offset.Y = 0,
            this.isAutoplay && this.play(),
            this.onslideend && this.onslideend(this.slideIndex),
            this.log("Event: afterslide")
        },
        e.prototype.orientationchangeHandler = function() {
            var e = this;
            setTimeout(function() {
                e.reset(),
                e.log("Event: orientationchange")
            },
            100)
        },
        e.prototype.reset = function() {
            this.pause(),
            this._setting(),
            this._renderHTML(),
            this.isAutoplay && this.play()
        },
        e.prototype.loadData = function(e, t) {
            this.pause(),
            this.slideIndex = t || 0,
            this.data = e,
            this._renderHTML(),
            this.isAutoplay && this.play()
        },
        e.prototype.play = function() {
            var e = this,
            t = this.duration;
            clearInterval(this.autoPlayTimer),
            this.autoPlayTimer = setInterval(function() {
                e.slideTo(e.slideIndex + 1)
            },
            t)
        },
        e.prototype.pause = function() {
            clearInterval(this.autoPlayTimer)
        },
        e.prototype.extend = function(t, i) {
            i || (i = e.prototype),
            Object.keys(t).forEach(function(e) {
                Object.defineProperty(i, e, Object.getOwnPropertyDescriptor(t, e))
            })
        },
        e
    } (),
    t = void 0,
    i = function(e) {
        var t = {
            rotate: function(e, t, i, n, o) {
                var a = "X" === t ? "Y": "X",
                r = Math.abs(o),
                s = window.getComputedStyle(this.wrap.parentNode, null).backgroundColor;
                this.isVertical && (o = -o),
                this.wrap.style.webkitPerspective = 4 * i,
                1 === n ? e.style.zIndex = i - r: e.style.zIndex = o > 0 ? (1 - n) * r: (n - 1) * r,
                e.style.cssText += "-webkit-backface-visibility:hidden; -webkit-transform-style:preserve-3d; background-color:" + s + "; position:absolute;",
                e.style.webkitTransform = "rotate" + a + "(" + 90 * (o / i + n - 1) + "deg) translateZ(" + .888 * i / 2 + "px) scale(0.888)"
            },
            flip: function(e, t, i, n, o) {
                var a = "X" === t ? "Y": "X",
                r = window.getComputedStyle(this.wrap.parentNode, null).backgroundColor;
                this.isVertical && (o = -o),
                this.wrap.style.webkitPerspective = 4 * i,
                o > 0 ? e.style.visibility = n > 1 ? "hidden": "visible": e.style.visibility = 1 > n ? "hidden": "visible",
                e.style.cssText += "position:absolute; -webkit-backface-visibility:hidden; background-color:" + r + ";",
                e.style.webkitTransform = "translateZ(" + i / 2 + "px) rotate" + a + "(" + 180 * (o / i + n - 1) + "deg) scale(0.875)"
            },
            depth: function(e, t, i, n, o) {
                var a = .18 * (4 - Math.abs(n - 1));
                this.wrap.style.webkitPerspective = 4 * i,
                e.style.zIndex = 1 === n ? 100 : o > 0 ? 1 - n: n - 1,
                e.style.webkitTransform = "scale(" + a + ", " + a + ") translateZ(0) translate" + t + "(" + (o + 1.3 * i * (n - 1)) + "px)"
            },
            flow: function(e, t, i, n, o) {
                var a = Math.abs(o),
                r = "X" === t ? "Y": "X",
                s = "X" === t ? 1 : -1,
                l = Math.abs(o / i);
                this.wrap.style.webkitPerspective = 4 * i,
                1 === n ? e.style.zIndex = i - a: e.style.zIndex = o > 0 ? (1 - n) * a: (n - 1) * a,
                e.style.webkitTransform = "scale(0.7, 0.7) translateZ(" + (150 * l - 150) * Math.abs(n - 1) + "px)translate" + t + "(" + (o + i * (n - 1)) + "px)rotate" + r + "(" + s * (30 - 30 * l) * (1 - n) + "deg)"
            },
            card: function(e, t, i, n, o) {
                var a = Math.abs(o);
                1 === n ? (e.style.zIndex = i - a, e.cur = 1) : e.style.zIndex = o > 0 ? (1 - n) * a * 1e3: (n - 1) * a * 1e3,
                e.cur && e.cur !== n && setTimeout(function() {
                    e.cur = null
                },
                300);
                var r = e.cur ? 1 - .2 * Math.abs(n - 1) - Math.abs(.2 * o / i).toFixed(6) : 1;
                e.style.webkitTransform = "scale(" + r + ", " + r + ") translateZ(0) translate" + t + "(" + ((1 + .2 * Math.abs(n - 1)) * o + i * (n - 1)) + "px)"
            }
        };
        e.prototype.extend(t, e.prototype._animateFuncs)
    } (e),
    n = function(e) {
        function t(e, t, i, n) {
            return "translate" + (b ? "3d(": "(") + e + "px," + t + (b ? "px," + i + "px)": "px)") + "scale(" + n + ")"
        }

        function i(e, t) {
            var i, n;
            return i = e.left - t.left,
            n = e.top - t.top,
            Math.sqrt(i * i + n * n)
        }

        function n(e, t) {
            return e + "px " + t + "px"
        }

        function o(e) {
            return Array.prototype.slice.call(e).map(function(e) {
                return {
                    left: e.pageX,
                    top: e.pageY
                }
            })
        }

        function a(e, t) {
            var n = i(e[0], e[1]),
            o = i(t[0], t[1]);
            return o / n
        }

        function r(e) {
            var t = {
                translateX: 0,
                translateY: 0,
                translateZ: 0,
                scaleX: 1,
                scaleY: 1,
                offsetX: 0,
                offsetY: 0
            },
            i = 0,
            n = 0;
            if (!window.getComputedStyle || !e) return t;
            var o, a, r = window.getComputedStyle(e);
            o = r.webkitTransform || r.mozTransform,
            a = r.webkitTransformOrigin || r.mozTransformOrigin;
            var s = a.match(/(.*)px\s+(.*)px/);
            if (s.length > 1 && (i = s[1] - 0, n = s[2] - 0), "none" == o) return t;
            var l = o.match(/^matrix3d\((.+)\)$/),
            d = o.match(/^matrix\((.+)\)$/);
            if (l) {
                var c = l[1].split(", ");
                t = {
                    translateX: c[12] - 0,
                    translateY: c[13] - 0,
                    translateZ: c[14] - 0,
                    offsetX: i - 0,
                    offsetY: n - 0,
                    scaleX: c[0] - 0,
                    scaleY: c[5] - 0,
                    scaleZ: c[10] - 0
                }
            } else if (d) {
                var c = d[1].split(", ");
                t = {
                    translateX: c[4] - 0,
                    translateY: c[5] - 0,
                    offsetX: i - 0,
                    offsetY: n - 0,
                    scaleX: c[0] - 0,
                    scaleY: c[3] - 0
                }
            }
            return t
        }

        function s(e, t) {
            return {
                x: (e.x + t.x) / 2,
                y: (e.y + t.y) / 2
            }
        }

        function l(e) {
            this.currentScale = 1,
            this.zoomFactor = e.zoomFactor || 2
        }

        function d(e) {
            if (this.useZoom) {
                var t = this.els[1].querySelector("img"),
                i = r(t);
                this.startTouches = o(e.targetTouches),
                this._startX = i.translateX - 0,
                this._startY = i.translateY - 0,
                this.currentScale = i.scaleX,
                this.zoomNode = t;
                var a = f(t);
                if (2 == e.targetTouches.length) {
                    console.log("gesture"),
                    this.lastTouchStart = null;
                    var l = e.touches,
                    d = s({
                        x: l[0].pageX,
                        y: l[0].pageY
                    },
                    {
                        x: l[1].pageX,
                        y: l[1].pageY
                    });
                    t.style.webkitTransformOrigin = n(d.x - a.left, d.y - a.top)
                } else if (1 === e.targetTouches.length) {
                    var c = (new Date).getTime();
                    this.gesture = 0,
                    c - this.lastTouchStart < 300 && (e.preventDefault(), this.gesture = 3),
                    this.lastTouchStart = c
                }
            }
        }

        function c(e) {
            var t = 0,
            i = this.zoomNode,
            n = this._device();
            return n.hasTouch ? (2 === e.targetTouches.length && this.useZoom ? (i.style.webkitTransitionDuration = "0", e.preventDefault(), this._scaleImage(e), t = 2) : 1 == e.targetTouches.length && this.useZoom && this.currentScale > 1 && (i.style.webkitTransitionDuration = "0", e.preventDefault(), this._moveImage(e), t = 1), this.gesture = t, t) : void 0
        }

        function p(e) {
            var i = this.zoomFactor || 2,
            o = this.zoomNode,
            a = f(o);
            this.currentScale = 1 == this.currentScale ? i: 1,
            o.style.webkitTransform = t(0, 0, 0, this.currentScale),
            1 != this.currentScale && (o.style.webkitTransformOrigin = n(e.touches[0].pageX - a.left, e.touches[0].pageY - a.top))
        }

        function h(e) {
            var i = o(e.targetTouches),
            n = a(this.startTouches, i);
            e.scale = e.scale || n;
            var r = this.zoomNode;
            n = this.currentScale * e.scale < y ? y: this.currentScale * e.scale,
            r.style.webkitTransform = t(0, 0, 0, n)
        }

        function u(e) {
            var t = 0;
            return 2 === this.gesture ? (this._resetImage(e), t = 2) : 1 == this.gesture ? (this._resetImage(e), t = 1) : 3 === this.gesture && (this._handleDoubleTap(e), this._resetImage(e)),
            t
        }

        function m(e) {
            var i = this.zoomNode,
            n = this._device(),
            o = {
                X: n.hasTouch ? e.targetTouches[0].pageX - this.startX: e.pageX - this.startX,
                Y: n.hasTouch ? e.targetTouches[0].pageY - this.startY: e.pageY - this.startY
            };
            this.moveOffset = {
                x: this._startX + o.X - 0,
                y: this._startY + o.Y - 0
            },
            i.style.webkitTransform = t(this.moveOffset.x, this.moveOffset.y, 0, this.currentScale)
        }

        function f(e) {
            var t = {
                left: 0,
                top: 0
            };
            do t.top += e.offsetTop || 0,
            t.left += e.offsetLeft || 0,
            e = e.offsetParent;
            while (e);
            return t
        }

        function v(e, t, i) {
            var n, o, a = f(e);
            x = {
                start: {
                    left: a.left,
                    top: a.top
                },
                end: {
                    left: a.left + e.clientWidth,
                    top: a.top + e.clientHeight
                }
            };
            var r = 1 == i ? "left": "top";
            return n = x.start[r],
            o = x.end[r],
            t >= n && o >= t
        }

        function g(e, t) {
            var i = 0,
            n = v(e, t.start.left, 1),
            o = v(e, t.end.left, 1),
            a = v(e, t.start.top, 0),
            r = v(e, t.end.top, 0);
            return n != o && a != r ? i = n && r ? 1 : n && a ? 2 : o && r ? 3 : 4 : n == o ? !a && r ? i = 5 : !r && a && (i = 6) : a == r ? !n && o ? i = 7 : n && !o && (i = 8) : a == r == n == o && (i = 9),
            i
        }

        function w(e) {
            if (1 != this.currentScale) {
                var i, n, o, a, s, l, d, c, p, h, u = this.zoomNode;
                switch (o = r(u), p = u.parentNode, a = u.clientWidth * o.scaleX, s = u.clientHeight * o.scaleX, l = f(u), d = {
                    left: (1 - o.scaleX) * o.offsetX + l.left + o.translateX,
                    top: (1 - o.scaleX) * o.offsetY + l.top + o.translateY
                },
                c = {
                    left: d.left + a,
                    top: d.top + s
                },
                i = d.left, n = d.top, h = g(p, {
                    start: d,
                    end: c
                })) {
                case 1:
                    i = x.start.left,
                    n = x.end.top - s;
                    break;
                case 2:
                    i = x.start.left,
                    n = x.start.top;
                    break;
                case 3:
                    i = x.end.left - a,
                    n = x.end.top - s;
                    break;
                case 4:
                    i = x.end.left - a,
                    n = x.start.top;
                    break;
                case 5:
                    n = x.end.top - s;
                    break;
                case 6:
                    n = x.start.top;
                    break;
                case 7:
                    i = x.end.left - a;
                    break;
                case 8:
                    i = x.start.left
                }
                a < p.clientWidth && (i = l.left - (o.scaleX - 1) * u.clientWidth / 2),
                s < p.clientHeight && (n = l.top - (o.scaleX - 1) * u.clientHeight / 2),
                u.style.webkitTransitionDuration = "100ms",
                u.style.webkitTransform = t(o.translateX + i - d.left, o.translateY + n - d.top, 0, o.scaleX)
            }
        }
        var b = "WebKitCSSMatrix" in window && "m11" in new WebKitCSSMatrix,
        y = .5,
        x = {};
        e.prototype.extend({
            _initZoom: l,
            _scaleImage: h,
            _moveImage: m,
            _resetImage: w,
            _handleDoubleTap: p,
            _moveHandler: c,
            _endHandler: u,
            _startHandler: d
        })
    } (e),
    o = function(e) {
        e.prototype.extend({
            addBtn: function() {
                if (!this.isVertical) for (var e = [], t = [], i = this, n = 0; 2 > n; n++) e[n] = document.createElement("div"),
                e[n].className = "islider-btn-outer",
                t[n] = document.createElement("div"),
                t[n].className = "islider-btn-inner",
                0 === n ? (e[n].className += " left", e[n].dir = -1) : (e[n].className += " right", e[n].dir = 1),
                e[n].addEventListener("click",
                function() {
                    var e = parseInt(this.getAttribute("dir"), 10);
                    i.slideTo(i.slideIndex + e)
                }),
                e[n].appendChild(t[n]),
                this.wrap.appendChild(e[n], this.wrap.nextSibling)
            }
        })
    } (e),
    a = function(e) {
        e.prototype.extend({
            addDot: function() {
                if (!this.isVertical) {
                    var e = this,
                    t = this.data,
                    i = [],
                    n = document.createElement("ul");
                    n.className = "islider-dot-wrap";
                    for (var o = document.createDocumentFragment(), a = 0; a < t.length; a++) i[a] = document.createElement("li"),
                    i[a].className = "islider-dot",
                    i[a].setAttribute("index", a),
                    a === this.slideIndex && (i[a].className += " active"),
                    i[a].addEventListener("click",
                    function() {
                        var t = parseInt(this.getAttribute("index"), 10);
                        e.slideTo(t)
                    }),
                    o.appendChild(i[a]);
                    n.appendChild(o),
                    this.wrap.parentNode.appendChild(n),
                    this.dotchange = function() {
                        for (var e = 0; e < t.length; e++) i[e].className = "islider-dot",
                        e === this.slideIndex && (i[e].className += " active")
                    }
                }
            }
        })
    } (e),
    window.iSlider = e
} (),
define("islider",
function(e) {
    return function() {
        var t;
        return t || e.iSlider
    }
} (this)),
function(e) {
    if ("function" == typeof define && define.amd) define("cookies", e);
    else if ("object" == typeof exports) module.exports = e();
    else {
        var t = window.Cookies,
        i = window.Cookies = e();
        i.noConflict = function() {
            return window.Cookies = t,
            i
        }
    }
} (function() {
    function e() {
        for (var e = 0,
        t = {}; e < arguments.length; e++) {
            var i = arguments[e];
            for (var n in i) t[n] = i[n]
        }
        return t
    }

    function t(i) {
        function n(t, o, a) {
            var r;
            if (arguments.length > 1) {
                if (a = e({
                    path: "/"
                },
                n.defaults, a), "number" == typeof a.expires) {
                    var s = new Date;
                    s.setMilliseconds(s.getMilliseconds() + 864e5 * a.expires),
                    a.expires = s
                }
                try {
                    r = JSON.stringify(o),
                    /^[\{\[]/.test(r) && (o = r)
                } catch(l) {}
                return o = encodeURIComponent(String(o)),
                o = o.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent),
                t = encodeURIComponent(String(t)),
                t = t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent),
                t = t.replace(/[\(\)]/g, escape),
                document.cookie = [t, "=", o, a.expires && "; expires=" + a.expires.toUTCString(), a.path && "; path=" + a.path, a.domain && "; domain=" + a.domain, a.secure ? "; secure": ""].join("")
            }
            t || (r = {});
            for (var d = document.cookie ? document.cookie.split("; ") : [], c = /(%[0-9A-Z]{2})+/g, p = 0; p < d.length; p++) {
                var h = d[p].split("="),
                u = h[0].replace(c, decodeURIComponent),
                m = h.slice(1).join("=");
                '"' === m.charAt(0) && (m = m.slice(1, -1));
                try {
                    if (m = i && i(m, u) || m.replace(c, decodeURIComponent), this.json) try {
                        m = JSON.parse(m)
                    } catch(l) {}
                    if (t === u) {
                        r = m;
                        break
                    }
                    t || (r[u] = m)
                } catch(l) {}
            }
            return r
        }
        return n.get = n.set = n,
        n.getJSON = function() {
            return n.apply({
                json: !0
            },
            [].slice.call(arguments))
        },
        n.defaults = {},
        n.remove = function(t, i) {
            n(t, "", e(i, {
                expires: -1
            }))
        },
        n.withConverter = t,
        n
    }
    return t()
}),
define("app/product/list/view/list", ["underscore", "jquery", "app/application", "app/common/view/pageableview", "app/product/list/view/item", "text!app/product/list/tpl/pageableview.html", "islider", "cookies"],
function(e, t, i, n, o, a, r, s) {
    "use strict";
    var l = n.extend({
        className: "content has-header has-footer",
        template: e.template(a),
        childView: o,
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res
            }
        },
        onAttach: function() {
            var e = [{
                content: '<a class="card-flip" href="' + i.ctx + '/products/54"><img src="' + i.res + '/banner-coffee.png"></img></a>'
            },
            {
                content: '<a class="card-flip" href="' + window.location.origin + '/martini?act_code=0004"><img src="' + i.res + '/banner-one.jpg"></img></a>'
            }];
            this.islider = new r({
                dom: this.$("#islider-wrapper")[0],
                data: e,
                type: "dom",
                duration: 3e3,
                isAutoplay: !0,
                isLooping: !0
            }),
            this.islider.addDot()
        }
    });
    return l
}),
define("app/product/list/view/annual-dinner", ["underscore", "jquery", "app/application", "app/common/view/pageableview", "app/product/list/view/item"],
function(e, t, i, n, o) {
    "use strict";
    var a = n.extend({
        className: "content has-header has-footer",
        childView: o
    });
    return a
}),
define("app/product/list/controller", ["jquery", "backbone", "marionette", "app/application", "app/collection/products", "app/common/view/page", "app/common/view/navigation", "app/common/view/loading", "app/common/view/selector", "app/product/list/view/list", "app/product/list/view/annual-dinner", "cookies"],
function(e, t, i, n, o, a, r, s, l, d, c, p) {
    "use strict";
    var h = i.Object.extend({
        listProducts: function() {
            var i, o = new s,
            c = n.rootView.getRegion("page");
            if (c.hasView() && c.currentView.isTopPage()) i = c.currentView,
            i.showChildView("content", o),
            i.getRegion("header").empty(),
            n.commands.execute("navigation:active", "product");
            else {
                var p = (new r).once("render",
                function() {
                    n.commands.execute("navigation:active", "product")
                });
                i = new a({
                    topPage: !0
                }).once("before:show",
                function() {
                    this.showChildView("navigation", p),
                    this.showChildView("content", o)
                }),
                c.show(i)
            }
            var h = n.reqres.request("product:entities"),
            u = t.Wreqr.radio.channel("persistent"),
            m = u.reqres.request("cities:persistent"),
            f = u.reqres.request("districts:persistent"),
            v = u.reqres.request("product:categories:persistent");
            e.when(h, m, f, v).done(function(e, t, n, o) {
                i.showChildView("content", new d({
                    collection: e
                })),
                i.showChildView("header", new l({
                    type: "product",
                    cities: t,
                    districts: n,
                    categories: o
                }))
            })
        },
        listAnnualDinners: function(i) {
            var o, d = new s,
            p = n.rootView.getRegion("page");
            if (p.hasView() && p.currentView.isTopPage()) o = p.currentView,
            o.showChildView("content", d),
            o.getRegion("header").empty(),
            n.commands.execute("navigation:active", "act");
            else {
                var h = (new r).once("render",
                function() {
                    n.commands.execute("navigation:active", "act")
                });
                o = new a({
                    topPage: !0
                }).once("before:show",
                function() {
                    this.showChildView("navigation", h),
                    this.showChildView("content", d)
                }),
                p.show(o)
            }
            var u = n.reqres.request("product:entities", i),
            m = t.Wreqr.radio.channel("persistent"),
            f = m.reqres.request("cities:persistent"),
            v = m.reqres.request("districts:persistent"),
            g = m.reqres.request("product:categories:persistent");
            e.when(u, f, v, g).done(function(e, t, i, n) {
                o.showChildView("content", new c({
                    collection: e
                })),
                o.showChildView("header", new l({
                    type: "product",
                    cities: t,
                    districts: i,
                    categories: n
                }))
            })
        },
        deleteTooltipCookie: function() {
            p.remove("tooltip-remove"),
            window.location.href = n.ctx
        }
    });
    return h
}),
define("text!app/common/tpl/header.html", [],
function() {
    return '<% if (backUrl) { %>\n  <a class="left" href="<%= backUrl %>">\n    <i class="icon icon-small icon-back icon-fix-1"></i>&nbsp;返回\n  </a>\n<% } %>\n<h1 class="title"><%= title %></h1>'
}),
define("app/common/view/header", ["underscore", "marionette", "text!app/common/tpl/header.html"],
function(e, t, i) {
    "use strict";
    var n = t.ItemView.extend({
        tagName: "header",
        className: "header bar fixed-top xdd-header",
        template: e.template(i),
        initialize: function(t) {
            e.extend(this, t)
        },
        serializeData: function() {
            return {
                title: this.title,
                backUrl: this.backUrl ? "string" == typeof this.backUrl ? this.backUrl: "javascript: history.back()": !1
            }
        }
    });
    return n
}),
define("text!app/product/detail/tpl/layout.html", [],
function() {
    return '<div id="detail"></div>\n<section id="recommend"></section>'
}),
define("app/product/detail/view/layout", ["underscore", "marionette", "text!app/product/detail/tpl/layout.html"],
function(e, t, i) {
    "use strict";
    var n = t.LayoutView.extend({
        className: "content has-header",
        template: e.template(i),
        regions: {
            detail: "#detail",
            recommend: "#recommend"
        },
        onBeforeShow: function() {
            this._parent._parent._parent.$el.addClass("page-bg")
        }
    });
    return n
}),
define("text!app/product/detail/tpl/detail.html", [],
function() {
    return '<!-- banner -->\n<div class="banner">\n  <div id="islider-wrapper">\n  </div>\n</div>\n<!-- banner ends -->\n\n<!-- price & feature entry -->\n<div class="list">\n  <div class="item price-tag">\n    <div class="item-lr">\n      <p class="lr-right">\n        <a href="<%= ctx %>/products/<%= product.get(\'id\') %>/buy" class="button button-small button-warning xdd-button buynow" data-gta="event" data-category="f_products_order" data-action="click" data-label="进入下单页面">\n          <i class="icon icon-small icon-cart icon-fix-1"></i>\n          <%= enums.productType[product.get(\'productType\')].code === 0 ? \'立即购买\' : \'立即预约\' %>\n        </a>\n      </p>\n      <div class="lr-left">\n        <h2 class="tag-name"><%= product.get(\'name\') %></h2>\n        <p class="price"><%= (product.get(\'price\') / 100).toFixed(0) %><small class="unit">元</small>\n      </div>\n    </div>\n  </div>\n  <div class="item item-body feature-label"><%= product.get(\'description\') %></div>\n</div>\n<!-- price & feature entry ends -->\n\n<!-- info tableview -->\n<% if (product.get(\'hotels\').length === 1) { %>\n  <div class="tableview">\n    <a class="map-url" href="<%= ctx %>/hotels/<%= product.get(\'hotels\')[0].id %>/map">\n      <div class="view-content">\n        <div class="view-media"><i class="icon icon-map-marker icon-fix-3"></i></div>\n        <div class="view-inner"><%= product.get(\'hotels\')[0].city + product.get(\'hotels\')[0].district + product.get(\'hotels\')[0].address %></div>\n      </div>\n    </a>\n    <% if (!!product.get(\'reservationStartTime\')) { %>\n      <div class="view-content">\n        <div class="view-media"><i class="icon icon-clock icon-fix-3"></i></div>\n        <div class="view-inner">营业时间 <%= product.get(\'reservationStartTime\') %> - <%= product.get(\'reservationEndTime\') %></div>\n      </div>\n    <% } %>\n  </div>\n<% } else { %>\n  <h3 class="bgmix-title">多店通用</h3>\n  <div class="tableview no-margin-bottom">\n    <div class="view-content">\n      <% for(i=0; i<2; i++) { %>\n        <div class="view-inner"><%= product.get(\'hotels\')[i].name %></div>\n        <a class="map-url" href="<%= ctx %>/hotels/<%= product.get(\'hotels\')[i].id %>/map">\n          <div class="view-inner"><i class="icon icon-map-marker icon-fix-3"></i><%= product.get(\'hotels\')[i].city + product.get(\'hotels\')[i].district + product.get(\'hotels\')[i].address %></div>\n        </a>\n      <% } %>\n    </div>    \n  </div>\n  <a class="more-info" href="<%= ctx %>/products/<%= product.get(\'id\') %>/hotels">查看全部<%= product.get(\'hotels\').length %>家酒店</a>\n  <% if (!!product.get(\'reservationStartTime\')) { %>\n    <h3 class="bgmix-title">使用时间</h3>\n    <div class="tableview">\n      <div class="view-content">\n        <div class="view-media"><i class="icon icon-clock icon-fix-3"></i></div>\n        <div class="view-inner"><%= product.get(\'reservationStartTime\') %> - <%= product.get(\'reservationEndTime\') %></div>\n      </div>\n    </div>\n  <% } %>\n<% } %>\n<!-- info tableview ends -->\n\n<!-- menus -->\n<% if (product.get(\'menus\')) { %>\n  <h3 class="bgmix-title">菜单</h3>\n  <div class="tableview no-margin-bottom" style="font-size: 12px;">\n    <% _.each(product.get(\'menus\'), function(submenus) { %>\n      <div class="view-content view-header">\n        <div class="view-inner"><%= submenus[0].groupName %></div>\n      </div>\n      <div class="view-content">\n        <div class="view-inner">\n          <% _.each(submenus, function(menu) { %>\n            <div class="item-lr">\n              <label class="lr-left"><%= menu.name %></label>\n            </div>\n          <% }) %>\n        </div>\n      </div>\n    <% }) %>\n  </div>\n  <a class="more-info" href="<%= ctx + "/products/" + product.get("id") + "/more" %>" title="">更多详情</a>\n<% } %>\n<!-- menus ends -->'
}),
define("app/product/detail/view/detail", ["underscore", "marionette", "app/application", "text!app/product/detail/tpl/detail.html", "islider"],
function(e, t, i, n, o) {
    "use strict";
    var a = t.ItemView.extend({
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                product: this.model,
                enums: i.enums()
            }
        },
        onAttach: function() {
            if (this.model.get("images")) {
                var e = this.model.get("images").map(function(e) {
                    return {
                        content: i.res + "/" + e.value + "!720.80B"
                    }
                });
                e.length && (this.islider = new o({
                    dom: this.$("#islider-wrapper")[0],
                    data: e
                }), this.islider.addDot())
            }
        }
    });
    return a
}),
define("text!app/common/tpl/recommend/item.html", [],
function() {
    return '  <div class="xdd-item-block">\n    <div class="xdd-item-img">\n      <img data-layzr="<%= res + \'/\' %><%= recommend.get(\'cover\') + \'!150x150.75nw\' %>">\n    </div>\n    <div class="xdd-item-info">\n      <h3 class="title"><%= recommend.get(\'name\') %></h3>\n      <p>\n        <span><%= recommend.get(\'category\') %></span>\n        <span>|</span>\n        <% if (type === \'product\') { %>\n          <span><%= recommend.get(\'price\') / 100 %>元</span>\n        <% } else { %>\n          <span><%= recommend.get(\'district\') %></span>\n        <% } %>\n      </p>\n      <div class="tag-quantity">\n        <div class="info-tag"><%= recommend.get(\'tags\').split(\',\')[0] %></div>\n      </div>\n    </div>\n  </div>\n  <% if (type === \'product\') { %>\n    <a class="link" href="<%= ctx %>/products/<%= recommend.get(\'id\') %>" data-gta="event" data-category="f_products_detail" data-action="click" data-label="进入产品详情页"></a>\n  <% } else { %>\n    <a class="link" href="<%= ctx %>/hotels/<%= recommend.get(\'id\') %>?businessType=banquet" data-gta="event" data-category="f_hotels_detail" data-action="click" data-label="进入酒店详情页"></a>\n  <% } %>\n'
}),
define("app/common/view/recommend/item", ["underscore", "marionette", "app/application", "text!app/common/tpl/recommend/item.html"],
function(e, t, i, n) {
    "use strict";
    return t.ItemView.extend({
        tagName: "div",
        className: "xdd-item",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                recommend: this.model,
                type: this.type
            }
        },
        initialize: function(t) {
            e.extend(this, t)
        }
    })
}),
define("text!app/common/tpl/recommend/recommend.html", [],
function() {
    return '<h3 class="bgmix-title">可能你会喜欢</h3>\n<div class="recommend-body">\n</div>\n'
}),
define("app/common/view/recommend/recommend", ["underscore", "marionette", "app/application", "app/common/view/recommend/item", "text!app/common/tpl/recommend/recommend.html"],
function(e, t, i, n, o) {
    "use strict";
    return t.CompositeView.extend({
        tagName: "section",
        className: "recommend",
        template: e.template(o),
        childView: n,
        childViewContainer: "div",
        childViewOptions: function(e, t) {
            return {
                type: this.collection.type
            }
        },
        onShow: function() {
            i.commands.execute("layzr:refresh")
        }
    })
}),
define("app/product/detail/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/product/detail/view/layout", "app/product/detail/view/detail", "app/common/view/recommend/recommend"],
function(e, t, i, n, o, a, r, s, l) {
    "use strict";
    var d = t.Object.extend({
        showProduct: function(t) {
            var d = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "美食详情"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(d);
            var c = i.reqres.request("product:entity", t),
            p = i.reqres.request("product:recommend:entities");
            e.when(c, p).done(function(e, t) {
                var i = (new r).once("show",
                function() {
                    this.showChildView("detail", new s({
                        model: e
                    })),
                    this.showChildView("recommend", new l({
                        collection: t
                    }))
                });
                d.showChildView("content", i)
            })
        }
    });
    return d
}),
function(e) {
    "object" == typeof exports ? module.exports = e: "function" == typeof define && define.amd ? define("formatDateTime", ["jquery"], e) : e(window.jQuery || window.$)
} (function(e) {
    var t = 24 * (718685 + Math.floor(492.5) - Math.floor(19.7) + Math.floor(4.925)) * 60 * 60 * 1e7,
    i = function(i, n, o) {
        var a = "",
        r = !1,
        s = 0,
        l = function(e) {
            var t = s + 1 < i.length && i.charAt(s + 1) == e;
            return t && s++,
            t
        },
        d = function(e, t, i) {
            var n = "" + t;
            if (l(e)) for (; n.length < i;) n = "0" + n;
            return n
        },
        c = function(e, t, i, n) {
            return l(e) ? n[t] : i[t]
        },
        p = function(e) {
            var t = o.utc;
            switch (e) {
            case "y":
                return t ? n.getUTCFullYear() : n.getFullYear();
            case "m":
                return (t ? n.getUTCMonth() : n.getMonth()) + 1;
            case "M":
                return t ? n.getUTCMonth() : n.getMonth();
            case "d":
                return t ? n.getUTCDate() : n.getDate();
            case "D":
                return t ? n.getUTCDay() : n.getDay();
            case "g":
                return (t ? n.getUTCHours() : n.getHours()) % 12 || 12;
            case "h":
                return t ? n.getUTCHours() : n.getHours();
            case "i":
                return t ? n.getUTCMinutes() : n.getMinutes();
            case "s":
                return t ? n.getUTCSeconds() : n.getSeconds();
            case "u":
                return t ? n.getUTCMilliseconds() : n.getMilliseconds();
            default:
                return ""
            }
        };
        for (s = 0; s < i.length; s++) if (r)"'" != i.charAt(s) || l("'") ? a += i.charAt(s) : r = !1;
        else switch (i.charAt(s)) {
        case "a":
            a += p("h") < 12 ? o.ampmNames[0] : o.ampmNames[1];
            break;
        case "d":
            a += d("d", p("d"), 2);
            break;
        case "S":
            var h = p(s && i.charAt(s - 1));
            a += h && (o.getSuffix || e.noop)(h) || "";
            break;
        case "D":
            a += c("D", p("D"), o.dayNamesShort, o.dayNames);
            break;
        case "o":
            var u = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime(),
            m = new Date(n.getFullYear(), 0, 0).getTime();
            a += d("o", Math.round((u - m) / 864e5), 3);
            break;
        case "g":
            a += d("g", p("g"), 2);
            break;
        case "h":
            a += d("h", p("h"), 2);
            break;
        case "u":
            a += d("u", p("u"), 3);
            break;
        case "i":
            a += d("i", p("i"), 2);
            break;
        case "m":
            a += d("m", p("m"), 2);
            break;
        case "M":
            a += c("M", p("M"), o.monthNamesShort, o.monthNames);
            break;
        case "s":
            a += d("s", p("s"), 2);
            break;
        case "y":
            a += l("y") ? p("y") : ("" + p("y")).substr(2);
            break;
        case "@":
            a += n.getTime();
            break;
        case "!":
            a += 1e4 * n.getTime() + t;
            break;
        case "'":
            l("'") ? a += "'": r = !0;
            break;
        default:
            a += i.charAt(s)
        }
        return a
    };
    e.fn.formatDateTime = function(t, n) {
        return n = e.extend({},
        e.formatDateTime.defaults, n),
        this.each(function() {
            var o = e(this).attr(n.attribute),
            a = t || e(this).attr(n.formatAttribute); ("undefined" == typeof o || o === !1) && (o = e(this).text()),
            "" === o ? e(this).text("") : e(this).text(i(a, new Date(o), n))
        }),
        this
    },
    e.formatDateTime = function(t, n, o) {
        return o = e.extend({},
        e.formatDateTime.defaults, o),
        n ? i(t, n, o) : ""
    },
    e.formatDateTime.defaults = {
        monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
        monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
        dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
        dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
        ampmNames: ["AM", "PM"],
        getSuffix: function(e) {
            if (e > 3 && 21 > e) return "th";
            switch (e % 10) {
            case 1:
                return "st";
            case 2:
                return "nd";
            case 3:
                return "rd";
            default:
                return "th"
            }
        },
        attribute: "data-datetime",
        formatAttribute: "data-dateformat",
        utc: !1
    }
}),
define("app/mixin/dateformat", ["jquery", "formatDateTime"],
function(e) {
    "use strict";
    return function() {
        this.formatDate = function(t, i) {
            return e.formatDateTime(i, new Date(t))
        }
    }
}),
define("app/model/order", ["underscore", "backbone", "app/application", "app/mixin/currency", "app/mixin/dateformat", "validation"],
function(e, t, i, n, o) {
    "use strict";
    e.extend(t.Model.prototype, t.Validation.mixin);
    var a = t.Model.extend({
        urlRoot: i.api + "/account/orders",
        defaults: {
            quantity: 1
        },
        isPaid: function() {
            var e = i.enums();
            return e.orderStatus[this.get("orderStatus")].code >= e.orderStatus.PAID.code
        },
        payable: function() {
            var e = i.enums();
            return e.orderStatus[this.get("orderStatus")].code === e.orderStatus.UNPAID.code
        },
        validation: {
            quantity: [{
                required: !0,
                msg: "数量不能为空"
            },
            {
                min: 1,
                msg: "数量不能小于1"
            },
            {
                max: 99,
                msg: "数量不能大于99"
            }],
            mobile: [{
                required: !0,
                msg: "手机号码不能为空"
            },
            {
                pattern: "digits",
                msg: "手机号码格式错误"
            },
            {
                length: 11,
                msg: "手机号码格式错误"
            }]
        }
    });
    return n.call(a.prototype),
    o.call(a.prototype),
    a
}),
define("text!app/product/buy/tpl/buy.html", [],
function() {
    return '<div class="checkout-board">\n  <h2 class="board-name"><%= product.get(\'hotels\').length > 1 ? \'\' : product.get(\'hotels\')[0].name %><%= product.get(\'name\') %></h2>\n  <p class="board-price price">\n    <span class="rmb">&yen;</span><%= product.currency(product.get(\'price\'), 2) %>\n  </p>\n</div>\n\n<form class="checkout-form" data-validate="true">\n\n  <input type="hidden" name="productId" value="<%= product.get(\'id\') %>" >\n\n  <section class="list xdd-light">\n    <div class="item quantity-item">\n      <div class="item-lr">\n        <div class="lr-right">\n          <div id="amount-control" class="amount-control" data-toggle="amount-control" data-minimum="1" <% if (product.get(\'limitedOnce\')) { %>data-maximum="<%= product.get(\'onceMax\') %>"<% } %> >\n            <a href="javascript:void(0)" data-decrease="1" data-target="#amount-control" class="amount-button minus"></a>\n            <input type="tel" name="quantity" value="<%=quantity %>" data-role="amount" class="amount" readonly>\n            <a href="javascript:void(0)" data-increase="1" data-target="#amount-control" class="amount-button plus"></a>\n          </div>\n        </div>\n        <p class="lr-left">\n          数量\n          <% if (product.get(\'limitedOnce\')) { %>\n            <span class="note">(最多可买<%= product.get(\'onceMax\') %>份)</span>\n          <% } %>\n        </p>\n      </div>\n    </div>\n\n    <div class="item"><p>付款后凭短信中的验证码到店消费</p></div>\n\n    <div class="item-divider"></div>\n\n    <div class="item phone-item field-row">\n      <label>手机号码</label>\n      <input type="tel" name="mobile" class="form-control" placeholder="用于短信获取套餐验证码" value="<%= userMobile %>" data-alias="手机号码" data-validate="required|integer|length,11">\n    </div>\n    <% if (!(product.get(\'productType\').toLowerCase() === \'groupon\')) { %>\n      <div class="item date-item field-row">\n        <label>预约日期</label>\n        <input type="text" name="reserveDate" id="calendar" class="form-control" readonly placeholder="选择预约日期" data-alias="预约日期" data-validate="required">\n      </div>\n      <div class="item date-item field-row">\n        <label>预约时间</label>\n        <input type="text" name="reserveTime" id="time" class="form-control" readonly placeholder="选择预约时间" data-alias="预约时间" data-validate="required">\n      </div>\n    <% } %>\n\n    <div class="item-divider"></div>\n\n    <div class="item total-item">\n      <p>应付：<span class="pay-price">&yen;<%= (total / 100).toFixed(2) %></span></p>\n    </div>\n  </section>\n\n  <div class="padding">\n    <button id="submit" class="button button-block button-warning xdd-button paynow" data-gta="event" data-category="f_order_submit" data-action="click" data-label="下一步">\n      <i class="icon icon-ok icon-fix-1"></i>&#x3000;下&#x3000;一&#x3000;步&#x3000;\n    </button>\n  </div>\n</form>'
}),
define("app/behavior/messagebar", ["underscore", "marionette", "messagebar"],
function(e, t, i) {
    "use strict";
    return t.Behavior.extend({
        defaults: {
            displayLength: 2e3,
            defaultClass: "alert-under-header"
        },
        onShowMessagebar: function(e, t, n) {
            t && (t = t.split(" ").concat(this.options.defaultClass).join(" ")),
            n || (n = this.options.displayLength),
            i(e, n, t)
        }
    })
}),
function(e) {
    var t = "object" == typeof self && self.self === self && self;
    if ("function" == typeof define && define.amd) define("scrollpicker", ["jquery", "backdrop"],
    function(i, n) {
        return t.ScrollPicker = e(t, i, n)
    });
    else if ("undefined" != typeof exports) {
        var i = require("jquery"),
        n = require("backdrop");
        module.exports = e(t, i, n)
    } else t.ScrollPicker = e(t, t.jQuery || t.Zepto || t.$, t.Backdrop)
} (function(e, t, i) {
    "use strict";
    var n = function() {
        function t(e) {
            return o === !1 ? !1 : "" === o ? e: o + e.charAt(0).toUpperCase() + e.substr(1)
        }
        var i = {},
        n = document.createElement("div").style,
        o = function() {
            for (var e, t = ["t", "webkitT", "MozT", "msT", "OT"], i = 0, o = t.length; o > i; i++) if (e = t[i] + "ransform", e in n) return t[i].substr(0, t[i].length - 1);
            return ! 1
        } ();
        i.extend = function(e, t) {
            for (var i in t) e[i] = t[i]
        };
        var a = t("transform");
        i.extend(i, {
            hasTransform: a !== !1,
            hasTouch: "ontouchstart" in e,
            hasTransition: t("transition") in n
        }),
        i.extend(i.style = {},
        {
            transform: a,
            transitionTimingFunction: t("transitionTimingFunction"),
            transitionDuration: t("transitionDuration"),
            transitionDelay: t("transitionDelay"),
            transformOrigin: t("transformOrigin")
        }),
        i.fontSizeNumer = function(e, t) {
            var i = 16,
            n = e.length,
            o = 16;
            if (n * o > t) for (;;) if (n * --i < t) {
                o = Math.round(i);
                break
            }
            return o
        };
        var r = 0;
        return i.uniqueId = function(e) {
            var t = ++r + "";
            return e ? e + t: t
        },
        i
    } (),
    o = function(e) {
        return e.data.length ? e.onValueConfirm && "function" == typeof e.onValueConfirm ? (this.backdrop = new i, this.isOpen = !1, this._processOptions(e), void this._init()) : (console.error("Scroll picker should have onValueConfirm callback to be specified..."), !1) : (console.error("Scroll picker needs data as selections..."), !1)
    };
    o.createScrollPicker = function(e) {
        return new o(e)
    },
    o.DEFAULTS = {
        cellHeight: 26,
        fraction: .003,
        confine: 16
    },
    o.prototype._init = function() {
        this._buildPicker()
    },
    o.prototype._processOptions = function(e) {
        this.options = t.extend(o.DEFAULTS, e),
        this.data = this.options.data,
        this.panels = [],
        this.options.cellHeight % 2 && console.error("Cell height should be divided by 2!"),
        this.options.confine = this.options.cellHeight / 2
    },
    o.prototype._buildPicker = function() {
        this.$picker = t(r);
        var e, i = [],
        o = this.data.length,
        s = n.uniqueId();
        for (e = 0; o > e; e++) {
            var l = e + "-" + s;
            i.push('<div class="picker-region" id="picker-region-' + l + '">'),
            i.push('<div id="region-' + l + '"></div></div>')
        }
        for (this.$picker.find(".scroll-picker-body").append(i.join("")), this.$picker.appendTo(t(document.body)), e = 0; o > e; e++) {
            var d = e + "-" + s,
            c = document.getElementById("region-" + d);
            this.panels[e] = new a(c, d, this.options, this.options.data[e])
        }
    },
    o.prototype.open = function() {
        var e = this;
        this.isOpen || (this.isOpen = !0, this.backdrop.open(this.$picker[0],
        function() {
            var i = t.support.transition && e.$picker.hasClass("fade");
            e.$picker.one("tap", '[data-dismiss="scrollpicker"]', t.proxy(e.close, e)),
            e.$picker.one("tap", '[data-confirm="scrollpicker"]', t.proxy(e.confirm, e)),
            e.$picker.show(),
            i && e.$picker[0].offsetWidth,
            e.$picker.addClass("in")
        }))
    },
    o.prototype.close = function(e) {
        e && e.preventDefault(),
        this.isOpen && (this.isOpen = !1, this.$picker.removeClass("in"), t.support.transition ? this.$picker.one(t.support.transition.end, t.proxy(this.hideScrollPicker, this)).emulateTransitionEnd(300) : this.hideScrollPicker())
    },
    o.prototype.hideScrollPicker = function() {
        this.$picker.hide(),
        this.backdrop.close()
    },
    o.prototype.confirm = function() {
        for (var e = [], t = 0; t < this.panels.length; t++) {
            var i = Math.round(Math.abs(this.panels[t].ul.slotY) / this.options.cellHeight);
            e.push(this.options.data[t][i])
        }
        this.close(),
        this.options.onValueConfirm(e)
    },
    o.prototype.destroy = function() {
        if (this.panels) for (var e = 0,
        t = this.panels.length; t > e; e++) this.panels[e]._destroy(),
        this.panels[e] = null;
        this.$picker.find("*").off(),
        this.$picker.off(),
        this.$picker.remove(),
        this.$picker = null,
        this.backdrop = null
    };
    var a = function(e, t, i, n) {
        this.element = e,
        this.uid = t,
        this.options = i,
        this.data = n,
        this.storageAnimationY = 0,
        this._buildPanel(),
        this._initEvents()
    };
    a.prototype._buildPanel = function() {
        var t = document.createDocumentFragment(),
        i = document.createElement("div");
        i.id = "picker-wrapper-" + this.uid,
        i.className = "picker-wrapper",
        t.appendChild(i);
        var o = document.createElement("div");
        o.id = "picker-inner-" + this.uid,
        o.className = "picker-inner",
        i.appendChild(o),
        this.frame = document.createElement("div"),
        this.frame.id = "picker-frame-" + this.uid,
        this.frame.className = "picker-frame",
        t.appendChild(this.frame);
        var a = document.createElement("div");
        if (a.className = "picker-empty", this.frame.appendChild(a), this.ul = document.createElement("ul"), this.ul.id = "picker-list-" + this.uid, this.ul.className = "picker-list", this.ul.style[n.style.transitionTimingFunction] = "cubic-bezier(0, 0, 0.2, 1)", this.ul.slotX = 0, this.ul.slotY = 0, this.ul.slotWidth = 0, o.appendChild(this.ul), this.element.appendChild(t), Array.isArray(this.data)) {
            var r = e.getComputedStyle(this.ul).width,
            s = [];
            this.data.forEach(function(e) {
                var t = n.fontSizeNumer(e.value, r.split("px")[0]);
                s.push('<li style="font-size: ' + t + 'px" data-key="' + e.key + '">' + e.desc + "</li>")
            }),
            this.ul.innerHTML = s.join(""),
            this.setSlotY(0)
        }
    },
    a.prototype.setSlotY = function(e) {
        this.ul.slotY = e,
        this.ul.style[n.style.transform] = "translate3d(0, " + e + "px, 0)"
    },
    a.prototype.scrollTo = function(e, t) {
        this.ul.style[n.style.transitionDuration] = t ? t: "100ms",
        this.setSlotY(e ? e: 0)
    },
    a.prototype._initEvents = function() {
        this._handleEvent = function(e) {
            e.currentTarget.id === "picker-frame-" + this.uid && ("touchstart" === e.type ? this.startScroll(e) : "touchmove" === e.type ? this.keepScroll(e) : "touchend" === e.type && this.endScroll(e)),
            e.preventDefault(),
            e.stopPropagation()
        },
        this._handleScroll = this._handleEvent.bind(this),
        this.frame.addEventListener("touchstart", this._handleScroll, !1)
    },
    a.prototype._unbindEvents = function() {
        this.frame.removeEventListener("touchstart", this._handleScroll, !1),
        this._handleScroll = null
    },
    a.prototype.startScroll = function(e) {
        this.ul.style[n.style.transitionDuration] = "0",
        this.startY = e.targetTouches[0].clientY,
        this.scrollStartY = this.ul.slotY,
        this.scrollStartTime = e.timeStamip,
        this.frame.addEventListener("touchmove", this._handleScroll, !1),
        this.frame.addEventListener("touchend", this._handleScroll, !1)
    },
    a.prototype.keepScroll = function(e) {
        var t = e.targetTouches[0].clientY - this.startY; (this.ul.slotY > 0 || this.ul.slotY < this.ul.slotMaxScroll) && (t /= 2),
        this.setSlotY(this.ul.slotY + t),
        this.startY = e.targetTouches[0].clientY,
        e.timeStamp - this.scrollStartTime > 80 && (this.scrollStartY = this.ul.slotY, this.scrollStartTime = e.timeStamp)
    },
    a.prototype.endScroll = function() {
        this.frame.removeEventListener("touchmove", this._handleScroll, !1),
        this.frame.removeEventListener("touchend", this._handleScroll, !1);
        var e = this.data.length,
        t = e - 1;
        if (this.ul.slotY) {
            var i = function(e) {
                return function(t) {
                    e.options.onValueChange && "function" == typeof e.options.onValueChange && e.options.onValueChange(t)
                }
            } (this);
            if (this.ul.slotY >= 0) return this.scrollTo(0),
            void i(this.data[0]);
            if (this.ul.slotY <= t * -this.options.cellHeight) return this.scrollTo(t * -this.options.cellHeight),
            void i(this.data[t]);
            var n, o = Math.abs(this.ul.slotY),
            a = Math.ceil(o / this.options.cellHeight),
            r = a * this.options.cellHeight,
            s = (a - 1) * this.options.cellHeight + this.options.confine;
            o > this.storageAnimationY ? o > s && r >= o ? (this.scrollTo( - r), i(this.data[a])) : (n = this.options.cellHeight * (a - 1), this.scrollTo( - n), i(this.data[a - 1]), this.storageAnimationY = n) : (this.storageAnimationY = o, o > s && r >= o ? (this.scrollTo( - r), i(this.data[a]), this.storageAnimationY = r) : (n = -(a - 1) * this.options.cellHeight, this.scrollTo(n), i(this.data[a - 1])))
        }
    },
    a.prototype._destroy = function() {
        this._unbindEvents(),
        this.frame = null,
        this.ul = null,
        this.element.innerHTML = "",
        this.element = null
    };
    var r = '<div class="scroll-picker-wrapper fade"><div class="scroll-picker-header"><div class="bar bar-header"><button class="button button-clear" data-dismiss="scrollpicker">关闭</button><button class=" button button-clear" data-confirm="scrollpicker">确定</button></div></div><div class="scroll-picker-body"><div class="select-zone top"></div><div class="select-zone middle"></div><div class="select-zone bottom"></div></div></div>';
    return o
}),
!
function(e, t) {
    "use strict";
    "function" == typeof define && define.amd ? define("amountcontrol", ["jquery"], t) : t("object" == typeof exports ? require("jquery") : e.jQuery || e.Zepto)
} (this,
function(e) {
    "use strict";

    function t(t) {
        return this.each(function() {
            var n = e(this),
            o = n.data("amount-control"),
            a = e.extend({},
            i.DEFAULTS, n.data(), "object" == typeof t && t);
            o || n.data("amount-control", o = new i(this, a))
        })
    }
    var i = function(t, i) {
        this.$el = e(t),
        this.$input = this.$el.find("input[data-role]"),
        this.$decrease = this.$el.find("[data-decrease]"),
        this.$increase = this.$el.find("[data-increase]"),
        this.options = i
    };
    i.DEFAULTS = {
        minimum: 0,
        maximum: 1 / 0,
        onChange: null
    },
    i.prototype.checkInput = function() {},
    i.prototype.change = function(e) {
        if (0 !== e) {
            var t = this.$input.val() - 0;
            e > 0 && t < this.options.maximum ? (this.$input.val(t + e), this.$decrease.hasClass("disabled") && this.$decrease.removeClass("disabled"), t + e >= this.options.maximum && this.$increase.addClass("disabled")) : 0 > e && t > this.options.minimum && (this.$input.val(t + e), this.$increase.hasClass("disabled") && this.$increase.removeClass("disabled"), t + e <= this.options.minimum && this.$decrease.addClass("disabled")),
            this.$input.trigger("amountcontrol:change"),
            this.options.onChange && this.options.onChange.call(this, this.$el, e)
        }
    },
    i.prototype.destroy = function() {
        e(document).off("tap.amountcontrol.increase", o),
        e(document).off("tap.amountcontrol.decrease", o)
    };
    var n = e.fn.amountControl;
    e.fn.amountControl = t,
    e.fn.amountControl.Constructor = i,
    e.fn.amountControl.noConflict = function() {
        return e.fn.amountControl = n,
        this
    };
    var o = function(i) {
        i.preventDefault();
        var n = e(this),
        o = e(n.data("target")),
        a = e.extend({},
        o.data(), n.data()),
        r = n.data("increase") ? n.data("increase") : 0 - n.data("decrease");
        t.call(o, a),
        r && o.data("amount-control").change(r)
    };
    e(document).on("tap.amountcontrol.increase", "[data-increase]", o).on("tap.amountcontrol.decrease", "[data-decrease]", o)
}),
+
function(e) {
    "use strict";

    function t(e, t) {
        if (e instanceof Date) return e;
        if ("string" != typeof e) throw new Error("Invalid date string");
        var i = e.split("-"),
        n = t.split("-"),
        o = new Date("1970-01-01");
        o.setHours(0),
        o.setMinutes(0),
        o.setSeconds(0),
        o.setMilliseconds(0);
        for (var a in n) {
            var r = i[a];
            "yyyy" === n[a] ? o.setFullYear(r) : "MM" === n[a] ? o.setMonth(r - 1) : "dd" === n[a] && o.setDate(r)
        }
        return o
    }

    function i(e) {
        return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0
    }

    function n(e, t) {
        var i = {
            dd: (e.getDate() < 10 ? "0": "") + e.getDate(),
            MM: (e.getMonth() + 1 < 10 ? "0": "") + (e.getMonth() + 1),
            yyyy: e.getFullYear()
        },
        n = t;
        for (var o in i) {
            var a = i[o];
            n = n.replace(o, a)
        }
        return n
    }

    function o(e) {
        var t = e.getFullYear(),
        i = e.getMonth();
        return i > 0 ? new Date(t, i - 1, 1, 0, 0, 0, 0) : new Date(t - 1, 11, 1, 0, 0, 0, 0)
    }

    function a(e) {
        var t = e.getFullYear(),
        i = e.getMonth();
        return 11 > i ? new Date(t, i + 1, 1, 0, 0, 0, 0) : new Date(t + 1, 0, 1, 0, 0, 0, 0)
    }

    function r(e) {
        var t = o(e),
        i = t.getFullYear(),
        n = t.getMonth(),
        a = s(i, n);
        return new Date(i, n, a, 0, 0, 0, 0)
    }

    function s(e, t) {
        return [31, i(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t]
    }

    function l(t) {
        return this.each(function() {
            var i = e(this),
            n = i.data("fancy.calendar");
            if (!n) {
                var o = e.extend({},
                d.DEFAULTS, i.data(), "object" == typeof t && t);
                i.data("fancy.calendar", n = new d(this, o))
            }
            "string" == typeof t ? n[t]() : n.open()
        })
    }
    var d = function(t, i) {
        this.$element = e(t),
        this.options = i,
        this.isOpen = !1,
        this.backdrop = new window.Backdrop,
        this.isInput = this.$element.is("input"),
        this.viewDate = new Date,
        this.date = new Date,
        this._processOptions(),
        this.$picker = e(c.calendar).appendTo(e(document.body)),
        this._buildCalendarHead(),
        this._buildCalendarBody(),
        this._bindEvents()
    };
    d.DEFAULTS = {
        format: "yyyy-MM-dd",
        weekStart: 0,
        startDate: -(1 / 0),
        endDate: 1 / 0,
        datesDisabled: void 0
    },
    d.prototype._buildCalendarHead = function() {
        for (var e = this.options.weekStart,
        t = "<tr>"; e < this.options.weekStart + 7;) t += "<th>" + h.zh.daysShort[e++%7] + "</th>";
        t += "</tr>",
        this.$picker.find(".calendar thead").append(t)
    },
    d.prototype._processOptions = function() {
        if (this.options.startDate !== -(1 / 0) && (this.options.startDate ? this.options.startDate instanceof Date || (this.options.startDate = t(this.options.startDate, this.options.format)) : this.options.startDate = -(1 / 0)), this.options.endDate !== 1 / 0 && (this.options.endDate ? this.options.endDate instanceof Date || (this.options.endDate = t(this.options.endDate, this.options.format)) : this.options.endDate = 1 / 0), this.isInput && this.$element.attr("readonly", "readonly"), this.options.datesDisabled) {
            var e = {};
            if ("string" == typeof this.options.datesDisabled) e[this.options.datesDisabled] = t(this.options.datesDisabled, this.options.format).getTime();
            else {
                if (! (this.options.datesDisabled instanceof Array)) throw new Error("Invalid dates disabled! It should be only a single date string or Array of date strings.");
                var i = this;
                this.options.datesDisabled.forEach(function(n) {
                    e[n] = t(n, i.options.format).getTime()
                })
            }
            this.options.datesDisabled = e
        } else this.options.datesDisabled = {};
        this.viewDate < this.options.startDate && (this.viewDate = this.options.startDate),
        this.viewDate > this.options.endDate && (this.viewDate = this.options.endDate),
        this.isInput && this.$element.val() ? this.activeDate = t(this.$element.val(), this.options.format) : !this.isInput && this.$element.data("activeDate").trim() && (this.activeDate = t(this.$element.data("activeDate").trim(), this.options.format))
    },
    d.prototype._bindEvents = function() {
        this.$picker.on("tap.fancy.calendar.confirm", '[data-confirm="calendar"]', e.proxy(this.confirm, this)),
        this.$picker.on("tap.fancy.calendar.dismiss", '[data-dismiss="calendar"]', e.proxy(this.close, this)),
        this.$picker.on("tap.fancy.calendar.flip", "[data-flip]", e.proxy(this.flip, this)),
        this.$picker.on("tap.fancy.calendar.pick", "a[data-value]", e.proxy(this.pickDay, this))
    },
    d.prototype._unbindEvents = function() {
        this.$picker.off()
    },
    d.prototype._buildCalendarBody = function() {
        var e, t = this.viewDate.getFullYear(),
        i = this.viewDate.getMonth(),
        r = o(this.viewDate),
        l = a(this.viewDate),
        d = new Date(this.date.getFullYear(), this.date.getMonth(), this.date.getDate(), 0, 0, 0, 0),
        c = new Date(t, i, 1, 0, 0, 0, 0),
        p = r.getMonth(),
        h = l.getMonth(),
        u = c.getDay() - this.options.weekStart,
        m = s(r.getFullYear(), r.getMonth());
        0 > u ? e = m - (6 + u) : u > 0 ? e = m - u + 1 : (e = 1, r.setMonth(i), r.setFullYear(t)),
        r.setDate(e);
        for (var f = r,
        v = [], g = 0;;) {
            f.getDay() === this.options.weekStart && v.push("<tr>");
            var w = "";
            w = f.getMonth() === p ? "prev": f.getMonth() === h ? "next": "now",
            (f < this.options.startDate || f > this.options.endDate || this.options.datesDisabled[n(f, this.options.format)] === f.getTime()) && (w += " disabled"),
            f.getTime() === d.getTime() && (w += " current"),
            this.activeDate instanceof Date && f.getTime() === this.activeDate.getTime() && (w += " active");
            var b = 'data-value="' + n(f, this.options.format) + '"';
            if (v.push('<td class="' + w + '"><a href="javascript: void(0)" ' + (f < this.options.startDate || f > this.options.endDate ? "": b) + ">" + f.getDate() + "</a></td>"), f.getDay() === (0 === this.options.weekStart ? 6 : this.options.weekStart - 1) && v.push("</tr>"), f.setDate(f.getDate() + 1), f.getDay() === this.options.weekStart && f.getMonth() === h) break;
            if (g++, g > 99) throw new Error("Infinite loop. There must be some errors...")
        }
        this.$picker.find(".calendar-body tbody").empty().append(v.join("")),
        this._refrehCalendarHead()
    },
    d.prototype._refrehCalendarHead = function() {
        var e = this.viewDate.getFullYear() + h.zh.yearSuffix + h.zh.months[this.viewDate.getMonth()];
        this.$picker.find(".calendar-body .current-month").text(e);
        var t = r(this.viewDate),
        i = a(this.viewDate);
        t < this.options.startDate ? this.$picker.find('[data-flip="prev"]').hide() : this.$picker.find('[data-flip="prev"]').show(),
        i > this.options.endDate ? this.$picker.find('[data-flip="next"]').hide() : this.$picker.find('[data-flip="next"]').show()
    },
    d.prototype.open = function() {
        var t = this,
        i = e.Event("open:fancy:calendar", {
            _relatedTarget: this.$picker[0]
        });
        this.$element.trigger(i),
        this.isOpen || i.isDefaultPrevented() || (this.isOpen = !0, this.backdrop.open(this.$picker[0],
        function() {
            var i = e.support.transition && t.$picker.hasClass("fade");
            t.$picker.show(),
            i && t.$picker[0].offsetWidth,
            t.$picker.addClass("in");
            var n = e.Event("opened:fancy:calendar", {
                _relatedTarget: t.$picker[0]
            });
            i ? t.$picker.one(e.support.transition.end,
            function() {
                t.$element.trigger(n)
            }).emulateTransitionEnd(300) : t.$element.trigger(n)
        }))
    },
    d.prototype.close = function(t) {
        t && t.preventDefault(),
        t = e.Event("close:fancy:calendar"),
        this.$element.trigger(t),
        this.isOpen && !t.isDefaultPrevented() && (this.isOpen = !1, this.$picker.removeClass("in"), e.support.transition ? this.$picker.one(e.support.transition.end, e.proxy(this.hideCalendar, this)).emulateTransitionEnd(300) : this.hideCalendar())
    },
    d.prototype.pickDay = function(i) {
        var n = e(i.target),
        o = n.parent();
        if (o.hasClass("now") && !o.hasClass("disabled")) this.$picker.find("table td.active").removeClass("active"),
        n.closest("td").addClass("active"),
        this.activeDate = t(n.data("value"), this.options.format);
        else if (!o.hasClass("disabled")) {
            this.$picker.find("table td.active").removeClass("active");
            var a = this,
            r = n.data("value");
            this.activeDate = t(r, this.options.format),
            this.$element.one("flip:fancy:calendar",
            function() {
                a.$picker.find('table a[data-value="' + r + '"]').trigger("tap")
            }),
            this.$picker.find('[data-flip="' + o.attr("class").trim() + '"]').trigger("tap");
        }
    },
    d.prototype.flip = function(t) {
        var i = e(t.target),
        n = i.data("flip");
        "next" === n ? this.viewDate = a(this.viewDate) : this.viewDate = o(this.viewDate),
        this._buildCalendarBody(),
        this.$element.trigger("flip:fancy:calendar")
    },
    d.prototype.confirm = function() {
        var e = this.$picker.find("table td.active");
        e.length && (this.isInput ? this.$element.val(e.children().data("value")) : this.$element.data("viewDate", e.children.data("value")), this.close())
    },
    d.prototype.hideCalendar = function() {
        var t = this;
        this.$picker.hide(),
        this.backdrop.close(function() {
            t.$element.trigger(e.Event("closed:fancy:calendar", {
                _relatedTarget: t.$picker[0]
            }))
        })
    },
    d.prototype._destroyCalendar = function() {
        this.$picker.find("*").off(),
        this.$picker.remove(),
        this.$picker = null
    },
    d.prototype.destroy = function() {
        this._unbindEvents(),
        this._destroyCalendar()
    };
    var c = {
        header: '<thead><tr><th><a href="javascript: void(0)" class="icon icon-small icon-chevron-left" data-flip="prev"></a></th><th colspan="5" class="current-month"></th><th><a href="javascript: void(0)" class="icon icon-small icon-chevron-right" data-flip="next"></a></th></tr></thead>'
    };
    c.calendar = '<div class="calendar fade"><div class="calendar-head"><a href="javascript: void(0)" class="button pull-left" data-dismiss="calendar">取消</a><a href="javascript: void(0)" class="button pull-right" data-confirm="calendar">确定</a></div><div class="calendar-body"><table>' + c.header + "<tbody></tbody></table></div></div>";
    var p = e.fn.calendar;
    e.fn.calendar = l,
    e.fn.calendar.Constructor = d;
    var h = e.fn.calendar.dates = {
        zh: {
            days: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
            daysShort: ["日", "一", "二", "三", "四", "五", "六", "日"],
            months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
            monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
            meridiem: ["am", "pm"],
            suffix: ["st", "nd", "rd", "th"],
            today: "今天",
            yearSuffix: "年"
        }
    };
    e.fn.noConflict = function() {
        return e.fn.calendar = p,
        this
    },
    e(document).ready(function() {
        e('[data-toggle="calendar"]').on("tap.fancy.calendar",
        function() {
            var t = e(this),
            i = t.data("fancy.calendar") ? "open": t.data();
            l.call(t, i)
        })
    })
} (window.jQuery || window.Zepto),
define("calendar", ["jquery", "transition", "backdrop"],
function() {}),
define("app/product/buy/view/buy", ["jquery", "underscore", "marionette", "app/application", "app/model/order", "text!app/product/buy/tpl/buy.html", "app/behavior/messagebar", "scrollpicker", "amountcontrol", "calendar", "validate"],
function(e, t, i, n, o, a, r, s) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(a),
        serializeData: function() {
            return {
                ctx: n.ctx,
                res: n.res,
                product: this.model,
                userMobile: this.user.get("mobile"),
                quantity: this.quantity,
                total: this.total
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: r
            }
        },
        ui: {
            amount: 'input[name="quantity"]',
            calendar: "#calendar",
            time: "#time",
            form: ".checkout-form"
        },
        events: {
            "amountcontrol:change @ui.amount": "onAmountChange",
            "tap @ui.calendar": "onOpenCalendar",
            "tap @ui.time": "onOpenTimePicker",
            "submit @ui.form": "onSubmitOrder"
        },
        initialize: function(e) {
            this.quantity = 1,
            this.total = this.model.get("price"),
            localStorage.orderData && this.model.get("id").toString() === JSON.parse(localStorage.orderData).productId && (this.quantity = JSON.parse(localStorage.orderData).quantity, this.total = this.model.get("price") * this.quantity),
            this.user = e.user,
            this.order = new o,
            this.listenTo(this.order, "validated:invalid", this.onOrderInvalid)
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        },
        onAmountChange: function(t) {
            this.$(".red-envelope").data("real-value");
            this.quantity = parseInt(e(t.target).val()),
            this.total = this.model.get("price") * this.quantity,
            this.$(".pay-price").html("&yen;" + (this.total / 100).toFixed(2))
        },
        onOpenCalendar: function(t) {
            t.preventDefault();
            var i = this.model.get("reservationDates"),
            n = i && i.startDate,
            o = i && i.endDate,
            a = i && i.datesDisabled,
            r = e(t.target),
            s = r.data("fancy.calendar") ? "open": {
                format: "yyyy-MM-dd",
                startDate: null === n ? new Date: n,
                endDate: null === o ? new Date: o,
                datesDisabled: a
            };
            r.calendar(s)
        },
        onOpenTimePicker: function() {
            var t = e("#time"),
            i = [],
            o = n.enums();
            "ANNUAL_DINNER" === this.model.get("productType") ? i.push([{
                key: o.lunchOrDinner.LUNCH.code,
                value: o.lunchOrDinner.LUNCH.description
            },
            {
                key: o.lunchOrDinner.DINNER.code,
                value: o.lunchOrDinner.DINNER.description
            }]) : i.push(this.model.get("reservationTimes").map(function(e) {
                return {
                    key: e,
                    value: e
                }
            })),
            this.timepicker = this.timepicker || s.createScrollPicker({
                data: i,
                onValueConfirm: function(e) {
                    t.val(e.pop().value)
                }
            }),
            this.timepicker.open()
        },
        onSubmitOrder: function(i) {
            i.preventDefault(),
            this.$("#submit").attr("disabled", "disabled");
            var o = e(i.target),
            a = t.object(o.serializeArray().map(function(e) {
                return t.values(e)
            })),
            r = n.enums();
            a.reserveTime === r.lunchOrDinner.LUNCH.description ? a.reserveTime = r.lunchOrDinner.LUNCH.code: a.reserveTime === r.lunchOrDinner.DINNER.description && (a.reserveTime = r.lunchOrDinner.DINNER.code),
            a.reserveDate && a.reserveTime && (a.reservationTime = a.reserveDate + " " + a.reserveTime, delete a.reserveDate, delete a.reserveTime),
            localStorage.setItem("orderData", JSON.stringify(a)),
            localStorage.total = this.total,
            this.order.set(a);
            var s = o.validate("check"),
            l = this.model.id;
            this.order.isValid(!0) && !s.length ? n.navigate("/products/" + l + "/checkout", {
                trigger: !0
            }) : s.length && (this.$("#submit").removeAttr("disabled"), this.triggerMethod("show:messagebar", s[0], "danger"))
        },
        onOrderInvalid: function(e, t) {
            var i = t[Object.keys(t)[0]];
            this.triggerMethod("show:messagebar", i, "danger")
        }
    })
}),
define("app/product/buy/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/product/buy/view/buy"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        buyProduct: function(t) {
            var s = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "购物车"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(s);
            var l = i.reqres.request("product:entity", t),
            d = i.reqres.request("account:entity");
            e.when(l, d).done(function(e, t) {
                s.showChildView("content", new r({
                    model: e,
                    user: t
                }))
            })
        }
    })
}),
define("app/model/hotel", ["backbone", "app/application"],
function(e, t) {
    "use strict";
    return e.Model.extend({
        urlRoot: t.api + "/hotels",
        defaults: {
            name: "",
            description: "",
            minimum: 0,
            cover: t.ctx + "/static/images/default-cover.png"
        },
        hasBusinessType: function(e) {
            return this.get("businessTypes").some(function(t) {
                return e === t.toLowerCase()
            })
        }
    })
}),
define("app/collection/hotels", ["underscore", "backbone", "app/application", "app/model/hotel", "paginator"],
function(e, t, i, n) {
    "use strict";
    return t.PageableCollection.extend({
        model: n,
        url: i.api + "/hotels",
        mode: "infinite",
        state: {
            pageSize: 10
        },
        queryParams: {
            bitBusinessType: function() {
                return this.bitBusinessType
            },
            cityCode: "310100",
            districtCode: void 0,
            categoryId: void 0
        },
        initialize: function(t, i) {
            e.extend(this, i)
        }
    })
}),
define("text!app/product/hotel/tpl/hotels.html", [],
function() {
    return '<div class="hotels-count">全部酒店共<%= hotels.length %>家</div>\n<div class="hotels-list">\n  <% _.each(hotels, function(hotel) { %>\n    <div class="hotel-item">\n    	<div class="hotel-name"><%= hotel.name %></div>\n    	<a class="map-url" href="<%= ctx %>/hotels/<%= hotel.id %>/map">\n        <div class="hotel-address">\n          <i class="icon icon-map-marker icon-fix-3"></i>\n      	  <div class="address"><%= hotel.district + " " + hotel.address %></div>\n        </div>\n      </a>\n    </div>\n  <% }) %>\n</div>'
}),
define("app/product/hotel/view/hotels", ["underscore", "marionette", "app/application", "app/collection/hotels", "text!app/product/hotel/tpl/hotels.html"],
function(e, t, i, n, o) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(o),
        serializeData: function() {
            return {
                ctx: i.ctx,
                hotels: this.model
            }
        }
    })
}),
define("app/product/hotel/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/product/hotel/view/hotels"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showProductHotels: function(t) {
            var s, l = new o,
            d = new a({
                backUrl: !0,
                title: "全部酒店"
            }),
            c = i.rootView.getRegion("page");
            c.hasView() && c.currentView.isTopPage() ? (s = c.currentView, s.showChildView("content", l), s.showChildView("header", d)) : (s = new n({
                topPage: !0
            }).once("before:show",
            function() {
                this.showChildView("header", d),
                this.showChildView("content", l)
            }), c.show(s));
            var p = i.reqres.request("product:entity", t);
            e.when(p).done(function(e) {
                var t = e.get("hotels"),
                i = new r({
                    model: t
                });
                s.showChildView("content", i)
            })
        }
    })
}),
define("text!app/product/more/tpl/more.html", [],
function() {
    return '<div class="more-list">\n  <% _.each(detailInfos, function(detailInfo) { %>\n    <div class="more-item">\n      <div class="more-title"><%= detailInfo.title %></div>\n      <div class="more-content"><%= detailInfo.content %></div>\n      <div class="more-image">\n        <img src="<%= res + "/" + detailInfo.image %>!m.listcover.nw" alt="">\n      </div>\n    </div>\n  <% }) %>\n</div>'
}),
define("app/product/more/view/more", ["underscore", "marionette", "app/application", "text!app/product/more/tpl/more.html"],
function(e, t, i, n) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                detailInfos: this.model
            }
        }
    })
}),
define("app/product/more/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/product/more/view/more"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showMoreInfos: function(t) {
            var s, l = new o,
            d = new a({
                backUrl: !0,
                title: "更多详情"
            }),
            c = i.rootView.getRegion("page");
            c.hasView() && c.currentView.isTopPage() ? (s = c.currentView, s.showChildView("content", l), s.showChildView("header", d)) : (s = new n({
                topPage: !0
            }).once("before:show",
            function() {
                this.showChildView("header", d),
                this.showChildView("content", l)
            }), c.show(s));
            var p = i.reqres.request("product:entity", t);
            e.when(p).done(function(e) {
                var t = e.get("detailInfos"),
                i = new r({
                    model: t
                });
                s.showChildView("content", i)
            })
        }
    })
}),
define("text!app/product/checkout/tpl/checkout.html", [],
function() {
    return '<div class="checkout-board">\n  <h2 class="board-name"><%= product.get(\'hotels\').length > 1 ? \'\' : product.get(\'hotels\')[0].name %><%= product.get(\'name\') %></h2>\n  <p class="board-price price">\n    <span class="rmb">&yen;</span><%= product.currency(product.get(\'price\'), 2) %>\n  </p>\n</div>\n\n<form class="checkout-form" data-validate="true">\n\n  <input type="hidden" name="productId" value="<%= product.get(\'id\') %>" >\n\n  <section class="list xdd-light">\n    <div class="item quantity-item">\n      <div class="item-lr">\n        <div style="width: auto;" class="lr-right">\n          <div id="amount-control" class="amount-control" data-toggle="amount-control" data-minimum="1" <% if (product.get(\'limitedOnce\')) { %>data-maximum="<%= product.get(\'onceMax\') %>"<% } %> >\n            <input type="tel" name="quantity" value="<%= orderData.quantity %>" data-role="amount" disabled="disabled" class="amount" readonly>\n          </div>\n        </div>\n        <p class="lr-left">\n          数量\n          <% if (product.get(\'limitedOnce\')) { %>\n            <span class="note">(最多可买<%= product.get(\'onceMax\') %>份)</span>\n          <% } %>\n        </p>\n      </div>\n    </div>\n\n    <div class="item"><p>付款后凭短信中的验证码到店消费</p></div>\n\n    <div class="item-divider"></div>\n\n    <div class="item phone-item field-row">\n      <label>手机号码</label>\n      <input type="tel" name="mobile" class="form-control" disabled="disabled" placeholder="用于短信获取套餐验证码" value="<%= orderData.mobile %>" data-alias="手机号码" data-validate="required|integer|length,11">\n    </div>\n    <% if (!(product.get(\'productType\').toLowerCase() === \'groupon\')) { %>\n      <div class="item date-item field-row">\n        <label>预约日期</label>\n        <input  disabled="disabled" value="<%= orderData.reserveDate %>" type="text" name="reserveDate" id="calendar" class="form-control" readonly placeholder="选择预约日期" data-alias="预约日期" data-validate="required">\n      </div>\n      <div class="item date-item field-row">\n        <label>预约时间</label>\n        <input type="text" disabled="disabled" value="<%= orderData.reserveTime %>" name="reserveTime" id="time" class="form-control" readonly placeholder="选择预约时间" data-alias="预约时间" data-validate="required">\n      </div>\n    <% } %>\n\n    <div class="item-divider"></div>\n    <div class="item envelope-item field-row chevron-right">\n      <label>席多多红包</label>\n      <div id="envelope" class="form-control navigation-control">\n        <% if (redEnvelopeCount) { %>\n          <span class="xdd-text-danger"><%= redEnvelopeCount %>张可用</span>\n        <% } else { %>\n          无可用红包\n        <% }%>\n      </div>\n      <input type="hidden" name="redEnvelopeId" value="">\n    </div>\n\n    <div class="item-divider"></div>\n\n    <div class="item total-item">\n      <p>应付：<span class="pay-price">&yen;<%= total %></span></p>\n    </div>\n  </section>\n\n  <div class="padding">\n    <button id="submit" class="button button-block button-warning xdd-button paynow" data-gta="event" data-category="f_order_submit" data-action="click" data-label="提交订单">\n      <i class="icon icon-ok icon-fix-1"></i>&#x3000;提&#x3000;交&#x3000;订&#x3000;单\n    </button>\n  </div>\n</form>'
}),
define("app/product/checkout/view/checkout", ["jquery", "underscore", "marionette", "app/application", "app/model/order", "text!app/product/checkout/tpl/checkout.html", "app/behavior/messagebar", "scrollpicker", "amountcontrol", "validate"],
function(e, t, i, n, o, a, r, s) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(a),
        serializeData: function() {
            return {
                ctx: n.ctx,
                res: n.res,
                product: this.model,
                redEnvelopeCount: this.redEnvelopes.length,
                orderData: this.orderData,
                total: (this.total / 100).toFixed(2)
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: r
            }
        },
        ui: {
            envelope: "#envelope",
            form: ".checkout-form"
        },
        events: {
            "tap @ui.envelope": "onOpenEnvelopePicker",
            "submit @ui.form": "onSubmitOrder"
        },
        initialize: function(e) {
            this.order = new o,
            this.orderData = JSON.parse(localStorage.orderData),
            this.orderData.redEnvelopeId = "",
            this.total = localStorage.total,
            this.redEnvelopes = e.redEnvelopes,
            this.listenTo(this.order, "validated:invalid", this.onOrderInvalid)
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        },
        onBeforeDestroy: function() {
            this.envelopePicker && (this.envelopePicker.destroy(), this.envelopePicker = null)
        },
        onOpenEnvelopePicker: function(t) {
            if (this.redEnvelopes.length) {
                var i = [],
                n = e(t.target),
                o = this.$el.find('input[name="redEnvelopeId"]');
                i.push(this.redEnvelopes.map(function(e) {
                    return {
                        key: e.get("id"),
                        value: "¥" + (e.get("amount") / 100).toFixed(2),
                        desc: e.get("description")
                    }
                }));
                var a = this;
                this.envelopePicker = this.envelopePicker || s.createScrollPicker({
                    data: i,
                    onValueConfirm: function(e) {
                        var t = e.pop();
                        o.val(t.key);
                        var i = 100 * parseFloat(t.value.slice(1));
                        a.redEnvelopeId = t.key,
                        a.total = localStorage.total - i;
                        var r = a.total > 0 ? (i / 100).toFixed(2) : ((a.model.get("price") * a.orderData.quantity - 1) / 100).toFixed(2);
                        n.html('<span class="xdd-text-danger red-envelope" data-real-value=' + i + ">-&nbsp;" + r + "</span>"),
                        a.$(".pay-price").html("&yen;" + ((a.total > 0 ? a.total: 1) / 100).toFixed(2))
                    }
                }),
                this.envelopePicker.open()
            }
        },
        onSubmitOrder: function(e) {
            e.preventDefault(),
            this.$("#submit").attr("disabled", "disabled"),
            this.orderData.redEnvelopeId = this.redEnvelopeId.toString(),
            this.order.set(this.orderData),
            this.order.save({},
            {
                success: function(e) {
                    n.navigate("/orders/" + e.get("id"), {
                        trigger: !0,
                        replace: !0
                    }),
                    localStorage.removeItem("orderData"),
                    localStorage.removeItem("total")
                }
            })
        }
    })
}),
define("app/product/checkout/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/product/checkout/view/checkout"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showCheckout: function(t) {
            var s = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "提交订单"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(s);
            var l = JSON.parse(localStorage.orderData),
            d = i.reqres.request("product:entity", t),
            c = i.reqres.request("account:entity"),
            p = i.reqres.request("redenvelope:entities", t, l.quantity);
            e.when(d, c, p).done(function(e, t, i) {
                s.showChildView("content", new r({
                    model: e,
                    user: t,
                    redEnvelopes: i
                }))
            })
        }
    })
}),
define("app/product/router", ["jquery", "marionette", "gta", "app/application", "app/model/product", "app/collection/products", "app/collection/recommends", "app/product/list/controller", "app/product/detail/controller", "app/product/buy/controller", "app/product/hotel/controller", "app/product/more/controller", "app/product/checkout/controller"],
function(e, t, i, n, o, a, r, s, l, d, c, p, h) {
    "use strict";
    var u = {
        _listController: new s,
        _detailController: new l,
        _buyController: new d,
        _hotelController: new c,
        _moreController: new p,
        _checkoutController: new h,
        _getProductEntities: function(t) {
            var i = e.Deferred(),
            n = new a(null, {
                productType: t
            });
            return n.getFirstPage({
                success: function(e) {
                    i.resolve(e)
                }
            }),
            i.promise()
        },
        _getProductEntity: function(t) {
            var i = e.Deferred(),
            n = new o({
                id: t
            });
            return n.fetch({
                success: function(e) {
                    i.resolve(e)
                }
            }),
            i.promise()
        },
        _getRecommendEntities: function() {
            var t = e.Deferred(),
            i = new r(null, {
                type: "product"
            });
            return i.fetch({
                success: function(e) {
                    t.resolve(e)
                }
            }),
            t.promise()
        },
        listProducts: function() {
            this._listController.listProducts()
        },
        showProduct: function(e) {
            this._detailController.showProduct(e)
        },
        buyProduct: function(e) {
            this._buyController.buyProduct(e)
        },
        showProductHotels: function(e) {
            this._hotelController.showProductHotels(e)
        },
        showMoreInfos: function(e) {
            this._moreController.showMoreInfos(e)
        },
        deleteTooltipCookie: function() {
            this._listController.deleteTooltipCookie()
        },
        showCheckout: function(e) {
            this._checkoutController.showCheckout(e)
        }
    };
    n.on("product:list",
    function() {
        n.navigate("products", {
            trigger: !0
        })
    }),
    n.reqres.setHandler("product:entities",
    function(e) {
        return u._getProductEntities(e)
    }),
    n.reqres.setHandler("product:entity",
    function(e) {
        return u._getProductEntity(e)
    }),
    n.reqres.setHandler("product:recommend:entities",
    function() {
        return u._getRecommendEntities()
    });
    var m = t.AppRouter.extend({
        controller: u,
        onRoute: function(e, t, n) {
            i.pageview(t, n)
        },
        appRoutes: {
            products: "listProducts",
            "products/tooltip/cookie/delete": "deleteTooltipCookie",
            "products/:id": "showProduct",
            "products/:id/buy": "buyProduct",
            "products/:id/hotels": "showProductHotels",
            "products/:id/more": "showMoreInfos",
            "products/:id/checkout": "showCheckout"
        }
    });
    return m
}),
define("text!app/hotel/list/tpl/item.html", [],
function() {
    return '<div class="xdd-item-block">\n	<div class="xdd-item-img">\n		<img data-layzr="<%= res + \'/\' %><%= hotel.get(\'cover\') + \'!150x150.75nw\' %>">\n	</div>\n	<div class="xdd-item-info">\n		<h3 class="title"><%= hotel.get(\'name\') %></h3>\n		<p>\n			<span><%= hotel.get(\'category\') %></span>\n			<span>|</span>\n			<span><%= hotel.get(\'district\') %></span>\n		</p>\n		<div class="tag-quantity">\n			<div class="info-tag"><%= hotel.get(\'tags\').split(\',\')[0] %></div>\n			<div class="contain-quantity">\n				<% if (isBanquet && hotel.hasBusinessType(type)) { %>\n			    <p class="desc">可容纳<%= hotel.get(\'maximum\') %>桌</p>\n			  <% } %>\n			  <% if (isMeeting && hotel.hasBusinessType(type)) { %>\n			    <p class="desc">可容纳<%= hotel.get(\'hallMaxDefault\') %>人 最大面积<%= hotel.get(\'hallMaxArea\') %>m<sup>2</sup></p>\n			  <% } %>\n			</div>\n		</div>\n	</div>\n</div>\n<a class="link" href="<%= ctx %>/hotels/<%= hotel.get(\'id\') %>?businessType=<%= type %>" data-gta="event" data-category="f_hotels_detail" data-action="click" data-label="进入酒店详情页"></a>\n'
}),
define("app/hotel/list/view/item", ["underscore", "marionette", "app/application", "text!app/hotel/list/tpl/item.html"],
function(e, t, i, n) {
    "use strict";
    return t.ItemView.extend({
        className: "xdd-item",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                hotel: this.model,
                type: this.options.type,
                isBanquet: "banquet" === this.options.type.toLowerCase(),
                isMeeting: "meeting" === this.options.type.toLowerCase()
            }
        }
    })
}),
define("app/hotel/list/view/list", ["app/common/view/pageableview", "app/hotel/list/view/item"],
function(e, t) {
    "use strict";
    return e.extend({
        className: "content has-header has-footer",
        childView: t,
        initialize: function(t) {
            this.type = t.type,
            e.prototype.initialize.call(this, t)
        },
        childViewOptions: function() {
            return {
                type: this.type
            }
        }
    })
}),
define("app/hotel/list/controller", ["jquery", "backbone", "marionette", "app/application", "app/collection/hotels", "app/common/view/page", "app/common/view/loading", "app/common/view/navigation", "app/common/view/selector", "app/hotel/list/view/list"],
function(e, t, i, n, o, a, r, s, l, d) {
    "use strict";
    return i.Object.extend({
        listHotels: function(i) {
            var o, c = new r,
            p = n.rootView.getRegion("page");
            if (p.hasView() && p.currentView.isTopPage()) o = p.currentView,
            o.showChildView("content", c),
            o.getRegion("header").empty(),
            n.commands.execute("navigation:active", i);
            else {
                var h = (new s).once("render",
                function() {
                    n.commands.execute("navigation:active", i)
                });
                o = new a({
                    topPage: !0
                }).once("before:show",
                function() {
                    this.showChildView("navigation", h),
                    this.showChildView("content", c)
                }),
                p.show(o)
            }
            var u = n.reqres.request("hotel:entities", i),
            m = t.Wreqr.radio.channel("persistent"),
            f = m.reqres.request("cities:persistent"),
            v = m.reqres.request("districts:persistent"),
            g = m.reqres.request("hotel:categories:persistent");
            e.when(u, f, v, g).done(function(e, t, n, a) {
                o.showChildView("content", new d({
                    collection: e,
                    type: i
                })),
                o.showChildView("header", new l({
                    cities: t,
                    districts: n,
                    categories: a
                }))
            })
        }
    })
}),
define("text!app/hotel/detail/tpl/layout.html", [],
function() {
    return '<div id="detail"></div>\n<section id="recommend"></section>\n<div class="hotel-footer">\n  <a href="tel:<%= hotel.get(\'phone\').split(\'-\')[0] %>">在线咨询</a>\n  <a href="<%= ctx %>/hotels/<%= hotel.get(\'id\') %>/book" data-gta="event" data-category="f_hotels_booking" data-action="click" data-label="进入预约看店页面">预约看店</a>\n</div>\n'
}),
define("app/hotel/detail/view/layout", ["app/application", "underscore", "marionette", "text!app/hotel/detail/tpl/layout.html"],
function(e, t, i, n) {
    "use strict";
    return i.LayoutView.extend({
        className: "content has-header",
        template: t.template(n),
        serializeData: function() {
            return {
                ctx: e.ctx,
                hotel: this.model
            }
        },
        regions: {
            detail: "#detail",
            recommend: "#recommend"
        },
        onBeforeShow: function() {
            this._parent._parent._parent.$el.addClass("page-bg")
        }
    })
}),
define("text!app/hotel/detail/tpl/detail.html", [],
function() {
    return '<!-- banner -->\n<div class="banner">\n  <div id="islider-wrapper">\n  </div>\n</div>\n<!-- banner ends -->\n\n<!-- price & feature entry -->\n<section class="list">\n  <div class="item price-tag">\n    <div class="item-lr">\n      <div class="lr-left">\n        <h2 class="tag-name"><%= hotel.get(\'name\') %></h2>\n        <p>¥ <span><%= hotel.get(\'referencePrice\') / 100 %></span>元/桌 起</p>\n      </div>\n    </div>\n  </div>\n</section>\n<!-- price & feature entry ends -->\n\n<!-- info tableview -->\n<section class="tableview no-margin-bottom">\n\n  <a class="map-url" href="<%= ctx %>/hotels/<%= hotel.get(\'id\') %>/map">\n    <div class="view-content">\n      <div class="view-media"><i class="icon icon-map-marker icon-fix-3"></i></div>\n      <div class="view-inner"><%= hotel.get(\'city\') + hotel.get(\'district\') + hotel.get(\'address\') %></div>\n    </div>\n  </a>\n  <div class="view-content">\n    <div class="view-media"><i class="icon icon-mobile icon-fix-3"></i></div>\n    <div class="view-inner">\n      预约电话&#x3000;<a href="tel:<%= hotel.get(\'phone\').split(\'-\')[0] %>" style="color: #555;"><%= hotel.get(\'phone\') %></a>\n    </div>\n  </div>\n</section>\n<!-- info tableview ends -->\n\n<!-- more info -->\n<a class="more-info" href="<%= ctx + "/hotels/" + hotel.get("id") + "/more" %>" title="">酒店详情介绍</a>\n<!-- more info ends -->\n\n<!-- hotel halls -->\n<h3 class="bgmix-title"><%= typeName %></h3>\n<section class="tableview <%= hallsNo > 2 ? \'no-margin-bottom\' : \'\' %> halls">\n  <% _.each(halls, function(hall) { %>\n    <div class="view-item">\n      <div class="hall-img">\n        <img src="<%= res %>/<%= hall.image %>!150x150.75nw" alt="宴会厅图片">\n      </div>\n      <div class="hall-content">\n        <div class="hall-name"><%= hall.name %></div>\n        <div class="hall-info"><%= hall.tables %>桌</div>\n        <div class="hall-info">\n          <span>层高：<%= hall.height %>m</span>\n          <span>柱数：<%= hall.pillars %></span>\n          <span>面积: <%= hall.area %>m<sup>2</sup></span>\n        </div>\n      </div>\n    </div>\n  <% }) %>\n</section>\n<% if(hallsNo > 2) { %>\n  <div id="more-halls" class="more-info">查看全部<%= hallsNo %>个<%= typeName %><i class="icon-arrow-bottom"></i></div>\n<% } %>\n<!-- hotel halls ends -->\n'
}),
define("app/hotel/detail/view/detail", ["app/application", "underscore", "marionette", "text!app/hotel/detail/tpl/detail.html", "islider"],
function(e, t, i, n, o) {
    "use strict";
    return i.ItemView.extend({
        template: t.template(n),
        serializeData: function() {
            return {
                ctx: e.ctx,
                res: e.res,
                hotel: this.model,
                type: this.options.type,
                typeName: "banquet" === this.options.type ? "宴会厅": "会议厅",
                halls: "banquet" === this.options.type ? this.model.get("banquetHalls") : this.model.get("meetingHalls"),
                hallsNo: "banquet" === this.options.type ? this.model.get("banquetHalls").length: this.model.get("meetingHalls").length
            }
        },
        ui: {
            moreHalls: "#more-halls"
        },
        events: {
            "click @ui.moreHalls": "onShowMoreHalls"
        },
        _initializeShowHalls: function() {
            this.$(".view-item").hide(),
            this.$(".view-item:eq(0)").show(),
            this.$(".view-item:eq(1)").show()
        },
        onShowMoreHalls: function() {
            var e = this.$("#more-halls"),
            t = this.$(".halls").find(".view-item"),
            i = e.find("i");
            i.hasClass("icon-arrow-bottom") ? (t.show(), i.removeClass("icon-arrow-bottom").addClass("icon-arrow-top")) : (this._initializeShowHalls(), i.removeClass("icon-arrow-top").addClass("icon-arrow-bottom"))
        },
        onRender: function() {
            this._initializeShowHalls()
        },
        onAttach: function() {
            if (this.model.get("images")) {
                var t = this.model.get("images").map(function(t) {
                    return {
                        content: e.res + "/" + t.value + "!720.80B"
                    }
                });
                t.length && (this.islider = new o({
                    dom: this.$("#islider-wrapper")[0],
                    data: t
                }), this.islider.addDot())
            }
        }
    })
}),
define("app/hotel/detail/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/hotel/detail/view/layout", "app/hotel/detail/view/detail", "app/common/view/recommend/recommend"],
function(e, t, i, n, o, a, r, s, l) {
    "use strict";
    return t.Object.extend({
        showHotel: function(t, d) {
            var c = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "酒店详情"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(c);
            var p = i.reqres.request("hotel:entity", t),
            h = i.reqres.request("hotel:recommend:entities");
            e.when(p, h).done(function(e, t) {
                var i = new r({
                    model: e
                }).once("show",
                function() {
                    this.showChildView("detail", new s({
                        model: e,
                        type: d
                    })),
                    this.showChildView("recommend", new l({
                        collection: t
                    }))
                });
                c.showChildView("content", i)
            })
        }
    })
}),
define("app/model/booking", ["underscore", "backbone", "app/application", "validation"],
function(e, t, i) {
    "use strict";
    return e.extend(t.Model.prototype, t.Validation.mixin),
    t.Model.extend({
        urlRoot: i.api + "/bookings",
        defaults: {
            phone: ""
        },
        validation: {
            phone: [{
                required: !0,
                msg: "手机号码不能为空"
            },
            {
                pattern: "digits",
                msg: "手机号码格式错误"
            },
            {
                length: 11,
                msg: "手机号码格式错误"
            }]
        }
    })
}),
define("text!app/hotel/book/tpl/book.html", [],
function() {
    return '<form class="book-form" action="<%= ctx %>/bookings">\n  <input type="hidden" name="hotelId" value="<%= hotel.get(\'id\') %>">\n  <p class="form-intro">我们的工作人员会第一时间联系您</p>\n  <div class="field-row">\n    <input type="tel" name="phone" class="form-control" placeholder="请输入手机号" >\n  </div>\n  <div class="padding clearfix">\n    <button id="submit" class="button button-block button-warning xdd-button" data-gta="event" data-category="f_hotels_submit" data-action="click" data-label="提交预约看店">\n      <i class="icon icon-mobile-calling icon-fix-1"></i>&#x3000;预&#x3000;约&#x3000;看&#x3000;店</button>\n  </div>\n</form>\n'
}),
define("app/hotel/book/view/book", ["jquery", "underscore", "marionette", "app/application", "app/model/booking", "text!app/hotel/book/tpl/book.html", "app/behavior/messagebar"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(a),
        serializeData: function() {
            return {
                ctx: n.ctx,
                res: n.res,
                hotel: this.model
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: r
            }
        },
        events: {
            "submit .book-form": "onSubmitBooking"
        },
        initialize: function() {
            this.booking = new o,
            this.listenTo(this.booking, "validated:invalid", this.onBookingInvalid)
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        },
        onSubmitBooking: function(i) {
            i.preventDefault();
            var o = e(i.target),
            a = t.object(o.serializeArray().map(function(e) {
                return t.values(e)
            }));
            if (this.booking.set(a), this.booking.isValid(!0)) {
                var r = this;
                this.booking.save({},
                {
                    success: function(e) {
                        n.navigate("/hotels/" + r.model.get("id") + "/booking/result", {
                            trigger: !0
                        })
                    }
                })
            }
        },
        onBookingInvalid: function(e, t) {
            var i = t[Object.keys(t)[0]];
            this.triggerMethod("show:messagebar", i, "danger")
        }
    })
}),
define("text!app/hotel/book/tpl/bookresult.html", [],
function() {
    return '<div class="xdd-board">\n  <h2 class="board-header theme-color">恭喜你已成功预约</h2>\n  <article class="board-content">\n    <p class="t-notice"><%= hotel.get(\'name\') %></p>\n    <p class="c-content">请留意您的手机，我们将尽快与您联系。</p>\n  </article>\n</div>'
}),
define("app/hotel/book/view/bookresult", ["underscore", "marionette", "app/application", "text!app/hotel/book/tpl/bookresult.html"],
function(e, t, i, n) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                hotel: this.model
            }
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        }
    })
}),
define("app/hotel/book/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/hotel/book/view/book", "app/hotel/book/view/bookresult"],
function(e, t, i, n, o, a, r, s) {
    "use strict";
    return t.Object.extend({
        bookHotel: function(t) {
            var s = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "获取优惠"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(s);
            var l = i.reqres.request("hotel:entity", t);
            e.when(l).done(function(e) {
                s.showChildView("content", new r({
                    model: e
                }))
            })
        },
        showBookingResult: function(t) {
            var r = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "预约结果"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(r);
            var l = i.reqres.request("hotel:entity", t);
            e.when(l).done(function(e) {
                r.showChildView("content", new s({
                    model: e
                }))
            })
        }
    })
}),
define("text!app/hotel/more/tpl/more.html", [],
function() {
    return '<div class="more-list">\n  <% _.each(detailInfos, function(detailInfo) { %>\n    <div class="more-item">\n      <div class="more-title"><%= detailInfo.title %></div>\n      <div class="more-content"><%= detailInfo.content %></div>\n      <% if(detailInfo.image) { %>\n        <div class="more-image">\n          <img src="<%= res + "/" + detailInfo.image %>!m.listcover.nw" alt="">\n        </div>\n      <% } %>\n    </div>\n  <% }) %>\n</div>'
}),
define("app/hotel/more/view/more", ["underscore", "marionette", "app/application", "text!app/hotel/more/tpl/more.html"],
function(e, t, i, n) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                detailInfos: this.model
            }
        }
    })
}),
define("app/hotel/more/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/hotel/more/view/more"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showMoreInfos: function(t) {
            var s, l = new o,
            d = new a({
                backUrl: !0,
                title: "更多介绍"
            }),
            c = i.rootView.getRegion("page");
            c.hasView() && c.currentView.isTopPage() ? (s = c.currentView, s.showChildView("content", l), s.showChildView("header", d)) : (s = new n({
                topPage: !0
            }).once("before:show",
            function() {
                this.showChildView("header", d),
                this.showChildView("content", l)
            }), c.show(s));
            var p = i.reqres.request("hotel:entity", t);
            e.when(p).done(function(e) {
                var t = e.get("detailInfos"),
                i = new r({
                    model: t
                });
                s.showChildView("content", i)
            })
        }
    })
}),
define("text!app/hotel/map/tpl/map.html", [],
function() {
    return '<style type="text/css">\n  #map {\n    width: 100%;\n    height: 25em;\n  }\n  .hotel-infos-title{\n    padding: 10px;\n    font-size: 16px;\n    color: black;\n    font-weight: bold;\n  }\n  .hotel-address{\n    padding: 0 10px;\n    font-size: 12px;\n  }\n</style>\n<div id="map" ></div>\n<div class="hotel-infos">\n  <div class="hotel-infos-title"><%= hotel.get(\'name\') %></div>\n  <div class="hotel-address"><%= hotel.get(\'city\') + hotel.get(\'district\') + hotel.get(\'address\') %></div>\n</div>'
}),
define("app/hotel/map/view/map", ["underscore", "marionette", "app/application", "text!app/hotel/map/tpl/map.html", "backbone"],
function(e, t, i, n, o) {
    "use strict";
    var a = o.View.extend({
        initialize: function(e, t, i) {
            var n = this,
            o = parseFloat(e),
            a = parseFloat(t),
            i = i;
            n._initBDMapCallBack(a, o, i),
            n._loadBDMap()
        },
        _loadBDMap: function() {
            var e = document.createElement("script");
            e.type = "text/javascript",
            e.src = "http://api.map.baidu.com/api?v=2.0&ak=821da73b83031b13a608a91c49610f2e&callback=MapCallback",
            document.body.appendChild(e)
        },
        _initBDMapCallBack: function(e, t, i) {
            var n = this;
            window.MapCallback = function() {
                n.map = new BMap.Map("map"),
                n.point = new BMap.Point(e, t),
                n.map.centerAndZoom(n.point, 15),
                n.map.enableScrollWheelZoom(!0);
                if ("" != e && "" != t) {
                    n.map.clearOverlays();
                    var o = new BMap.Point(e, t),
                    a = new BMap.Marker(o);
                    n.map.addOverlay(a),
                    n.map.panTo(o);
                    var r = new BMap.InfoWindow(i);
                    a.addEventListener("click",
                    function() {
                        n.map.openInfoWindow(r, o)
                    })
                }
            }
        }
    });
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                hotel: this.model
            }
        },
        onBeforeRender: function() {
            var e = this.model.get("position").latitude,
            t = this.model.get("position").longitude,
            i = this.model.city + this.model.district + this.model.address;
            new a(e, t, i)
        }
    })
}),
define("app/hotel/map/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/hotel/map/view/map"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showMap: function(t) {
            var s, l = (new o, new a({
                backUrl: !0,
                title: "地图加载中"
            })),
            d = i.rootView.getRegion("page");
            s = new n({
                topPage: !0
            }).once("before:show",
            function() {
                this.showChildView("header", l)
            }),
            d.show(s);
            var c = i.reqres.request("hotel:entity", t);
            e.when(c).done(function(e, t) {
                s.showChildView("header", new a({
                    backUrl: !0,
                    title: e.get("name")
                })),
                s.showChildView("content", new r({
                    model: e,
                    type: t
                }))
            })
        }
    })
}),
define("app/hotel/router", ["jquery", "marionette", "gta", "app/application", "app/model/hotel", "app/collection/hotels", "app/collection/recommends", "app/hotel/list/controller", "app/hotel/detail/controller", "app/hotel/book/controller", "app/hotel/more/controller", "app/hotel/map/controller"],
function(e, t, i, n, o, a, r, s, l, d, c, p) {
    "use strict";
    var h = {
        _listController: new s,
        _detailController: new l,
        _bookController: new d,
        _moreController: new c,
        _mapController: new p,
        showMap: function(e, t) {
            this._mapController.showMap(e, t)
        },
        _getHotelEntities: function(t) {
            var i = e.Deferred(),
            o = new a(null, {
                bitBusinessType: n.enums().businessType[t.toUpperCase()].code
            });
            return o.getFirstPage({
                success: function(e) {
                    i.resolve(e)
                }
            }),
            i.promise()
        },
        _getHotelEntity: function(t) {
            var i = e.Deferred(),
            n = new o({
                id: t
            });
            return n.fetch({
                success: function(e) {
                    i.resolve(e)
                }
            }),
            i.promise()
        },
        _getRecommendEntities: function() {
            var t = e.Deferred(),
            i = new r(null, {
                type: "hotel"
            });
            return i.fetch({
                success: function(e) {
                    t.resolve(e)
                }
            }),
            t.promise()
        },
        listHotels: function(e) {
            this._listController.listHotels(e)
        },
        showHotel: function(e, t) {
            this._detailController.showHotel(e, t)
        },
        showMoreInfos: function(e) {
            this._moreController.showMoreInfos(e)
        },
        bookHotel: function(e) {
            this._bookController.bookHotel(e)
        },
        showBookingResult: function(e) {
            this._bookController.showBookingResult(e)
        }
    };
    n.reqres.setHandler("hotel:entities",
    function(e) {
        return h._getHotelEntities(e)
    }),
    n.reqres.setHandler("hotel:entity",
    function(e) {
        return h._getHotelEntity(e)
    }),
    n.reqres.setHandler("hotel:recommend:entities",
    function() {
        return h._getRecommendEntities()
    });
    var u = t.AppRouter.extend({
        controller: h,
        onRoute: function(e, t, n) {
            i.pageview(t, n)
        },
        appRoutes: {
            "hotels?businessType=:type": "listHotels",
            "hotels/:id?businessType=:type": "showHotel",
            "hotels/:id/more": "showMoreInfos",
            "hotels/:id/book": "bookHotel",
            "hotels/:id/booking/result": "showBookingResult",
            "hotels/:id/map": "showMap"
        }
    });
    return u
}),
define("app/model/user", ["backbone", "app/application"],
function(e, t) {
    "use strict";
    return e.Model.extend({
        urlRoot: t.api + "/account",
        defaults: {
            nickname: "",
            gender: "",
            email: ""
        }
    })
}),
define("app/collection/orders", ["underscore", "backbone", "app/application", "app/model/order"],
function(e, t, i, n) {
    "use strict";
    return t.Collection.extend({
        model: n,
        url: i.api + "/account/orders",
        initialize: function(t, i) {
            e.extend(this, i)
        }
    })
}),
define("app/model/redenvelope", ["backbone", "app/application"],
function(e, t) {
    "use strict";
    return e.Model.extend({
        urlRoot: t.api + "/red-envelopes",
        defaults: {
            amount: 0,
            mobile: ""
        }
    })
}),
define("app/collection/redenvelopes", ["backbone", "app/application", "app/model/redenvelope"],
function(e, t, i) {
    "use strict";
    return e.Collection.extend({
        model: i,
        url: t.api + "/account/red-envelopes"
    })
}),
define("text!app/account/profile/tpl/profile.html", [],
function() {
    return '<!-- banner -->\n<figure class="profile-banner">\n  <div class="user-info">\n    <a href="javascript: void(0)" class="avatar">\n      <img src="<%= ctx %>/static/images/icons/profile-active.png">\n    </a>\n    <p class="username"><%= user.get(\'nickname\') %></p>\n  </div>\n</figure>\n<!-- banner ends -->\n\n<div id="order-section"></div>\n\n<div class="ucenter-space"></div>\n\n<div class="ucenter-content">\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/profile/info">\n      <i class="icon icon-order icon-fix-3"></i>\n      我的资料\n      <i class="icon-arrow-right"></i>\n    </a>\n  </div>\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/orders">\n      <i class="icon icon-order icon-fix-3"></i>\n      我的订单\n      <% if(pendingOrdersNo) { %>\n        <i class="order-remind"></i>\n      <% } %>\n      <i class="icon-arrow-right"></i>\n    </a>\n  </div>\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/redenvelopes">\n      <i class="icon icon-order icon-fix-3"></i>\n      我的红包\n      <i class="icon-arrow-right"></i>\n    </a>\n  </div>\n  <div class="ucenter-item">\n    <a href="#">\n      <i class="icon icon-order icon-fix-3"></i>\n      我的积分\n      <span><strong class="dark-gold"><%= user.get(\'totalScore\') %></strong><small>分</small></span>\n    </a>\n  </div>\n</div>\n\n<div class="ucenter-space"></div>\n\n<!-- logout button -->\n<a href="<%= ctx %>/logout" data-bypass class="button button-full xdd-logout-button">退出登录</a>\n<!-- logout button ends -->\n\n<div class="service-tel">\n  <i class="icon icon-mobile icon-fix-3"></i>\n  <a href="tel:4000327300">客服电话：4000-327-300</a>\n</div>'
}),
define("app/account/profile/view/profile", ["underscore", "marionette", "app/application", "text!app/account/profile/tpl/profile.html"],
function(e, t, i, n) {
    "use strict";
    return t.LayoutView.extend({
        className: "content has-header has-footer",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                user: this.model,
                pendingOrdersNo: this.options.pendingOrdersNo
            }
        }
    })
}),
define("app/account/profile/controller", ["jquery", "backbone", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/common/view/navigation", "app/account/profile/view/profile"],
function(e, t, i, n, o, a, r, s, l) {
    "use strict";
    return i.Object.extend({
        showProfile: function() {
            var t, i = new a,
            d = new r({
                title: "个人中心"
            }),
            c = n.rootView.getRegion("page");
            if (c.hasView() && c.currentView.isTopPage()) t = c.currentView,
            t.showChildView("content", i),
            t.showChildView("header", d),
            n.commands.execute("navigation:active", "profile");
            else {
                var p = (new s).once("render",
                function() {
                    n.commands.execute("navigation:active", "profile")
                });
                t = new o({
                    topPage: !0
                }).once("before:show",
                function() {
                    this.showChildView("header", d),
                    this.showChildView("navigation", p),
                    this.showChildView("content", i)
                }),
                c.show(t)
            }
            var h = n.reqres.request("account:entity"),
            u = n.reqres.request("order:entities");
            e.when(h, u).done(function(e, i) {
                var o = 0,
                a = n.enums();
                i.forEach(function(e) { (a.orderStatus[e.get("orderStatus")].code === a.orderStatus.UNAUDIT.code || a.orderStatus[e.get("orderStatus")].code === a.orderStatus.UNPAID.code) && (o += 1)
                });
                var r = new l({
                    model: e,
                    pendingOrdersNo: o
                });
                t.showChildView("content", r)
            })
        }
    })
}),
define("text!app/account/signup/tpl/signup.html", [],
function() {
    return '<form id="signup-form" method="post" data-validate="true">\n  <div class="field-row">\n    <label>手机号</label>\n    <input type="tel" class="form-control" name="mobile" placeholder="填写注册手机号码" data-alias="手机号" data-validate="required|digit|length,11">\n  </div>\n  <div class="field-row">\n    <label>验证码</label>\n    <input type="tel" name="vcode" class="form-control has-xwide-suffix" placeholder="填写验证码" data-alias="验证码" data-validate="required">\n    <a href="javascript: void(0)" id="verify-button" class="button button-small button-warning suffix xdd-button" data-toggle="countdown">获取验证码</a>\n  </div>\n  <div class="field-row">\n    <label>昵称</label>\n    <input type="text" name="nickname" class="form-control" placeholder="填写用户昵称" data-alias="昵称" data-validate="required">\n  </div>\n  <div class="field-row">\n    <label>设置密码</label>\n    <input type="password" name="password" id="password" class="form-control" placeholder="6-20位字母或数字组成" data-alias="密码" data-validate="required|match,#confirmed-password|length_min,6|length_max,20">\n  </div>\n  <div class="field-row">\n    <label>确认密码</label>\n    <input type="password" id="confirmed-password" class="form-control" placeholder="再次输入密码" data-alias="确认密码" data-validate="required|match,#password|length_min,6|length_max,20">\n  </div>\n  <p class="signup-tips">短信验证码将发送至该手机号，请认真填写</p>\n  <div class="padding">\n    <button type="submit" class="button button-block button-warning xdd-button" data-gta="event" data-category="f_signup_submit" data-action="click" data-label="提交用户注册">\n      <i class="icon icon-edit icon-fix-3"></i>&#x3000;&#x3000;注&#x3000;&#x3000;册\n    </button>\n  </div>\n</form>\n\n<div id="modal" class="modal fade holding-dialog">\n  <div class="modal-dialog text-center">\n    <a href="#" class="dismiss" data-dismiss="modal">&times;</a>\n    <div class="dialog-body">\n      <img src="<%= ctx %>/static/images/loader.gif" class="loader"><br>\n      <span class="dialog-content">正在提交数据</span>\n    </div>\n  </div>\n</div>'
}),
function(e, t) {
    if ("function" == typeof define && define.amd) define("modal", ["jquery", "backdrop"], t);
    else if ("undefined" != typeof exports) {
        var i = require("jquery"),
        n = require("backdrop");
        t(i, n)
    } else t(e.Zepto || e.jQuery || e.$, e.Backdrop)
} (this,
function(e, t) {
    "use strict";

    function i(t, i) {
        return this.each(function() {
            var o = e(this),
            a = o.data("fancy.modal"),
            r = e.extend({},
            o.data(), "object" == typeof t && t);
            a || o.data("fancy.modal", a = new n(this, r)),
            "string" == typeof t ? a[t](i) : r.show && a.show(i)
        })
    }
    var n = function(i, n) {
        this.options = n,
        this.$body = e(document.body),
        this.$element = e(i),
        this.$dialog = this.$element.find(".modal-dialog"),
        this.backdrop = new t,
        this.isShown = null
    };
    n.prototype.toggle = function(e) {
        return this.isShown ? this.hide() : this.show(e)
    },
    n.prototype.show = function(t) {
        var i = this,
        n = e.Event("show:fancy:modal", {
            relatedTarget: t
        });
        this.$element.trigger(n),
        this.isShown || n.isDefaultPrevented() || (this.isShown = !0, this.$body.addClass("modal-open"), this.$element.one("tap.dismiss.fancy.modal", '[data-dismiss="modal"]', e.proxy(this.hide, this)), this.backdrop.open(this.$element,
        function() {
            var n = e.support.transition && i.$element.hasClass("fade");
            i.$element.show().scrollTop(0),
            n && i.$element[0].offsetWith,
            i.$element.addClass("in");
            var o = e.Event("shown:fancy:modal", {
                relatedTarget: t
            });
            n ? i.$dialog.one(e.support.transition.end,
            function() {
                i.$element.trigger("focus").trigger(o)
            }).emulateTransitionEnd(300) : i.$element.trigger("focus").trigger(o)
        }))
    },
    n.prototype.hide = function(t) {
        t && t.preventDefault(),
        t = e.Event("hide:fancy:modal"),
        this.$element.trigger(t),
        this.isShown && !t.isDefaultPrevented() && (this.isShown = !1, this.$body.removeClass("modal-open"), this.$element.removeClass("in"), e.support.transition && this.$element.hasClass("fade") ? this.$element.one(e.support.transition.end, e.proxy(this.hideDialog, this)).emulateTransitionEnd(300) : this.hideDialog())
    },
    n.prototype.hideDialog = function() {
        var e = this;
        this.$element.hide(),
        this.backdrop.close(function() {
            e.$element.trigger("hidden:fancy:modal")
        })
    },
    n.prototype.destory = function() {
        this.backdrop = null
    };
    var o = e.fn.modal;
    e.fn.modal = i,
    e.fn.modal.Constructor = n,
    e.fn.modal.noConflict = function() {
        return e.fn.modal = o,
        this
    }
}),
define("app/behavior/holdingdialog", ["jquery", "marionette", "modal"],
function(e, t) {
    "use strict";
    return t.Behavior.extend({
        onShowHoldingdialog: function() {
            this.$el.find(".holding-dialog").modal("show")
        },
        onHideHoldingdialog: function() {
            this.$el.find(".holding-dialog").modal("hide")
        },
        onChangeContentHoldingdialog: function(e) {
            this.$el.find(".holding-dialog").find(".dialog-content").text(e)
        },
        onChangeBodyHoldingdialog: function(e) {
            this.$el.find(".holding-dialog").find(".dialog-body").html(e)
        }
    })
}),
define("app/behavior/countdown", ["jquery", "marionette", "countdown"],
function(e, t) {
    "use strict";
    return t.Behavior.extend({
        defaults: {
            duration: 60,
            message: "s",
            callback: function() {}
        },
        onStartCountdown: function() {
            this.$el.find('[data-toggle="countdown"]').countdown(this.options.message, this.options.duration, this.options.callback.bind(this))
        }
    })
}),
define("app/account/signup/view/signup", ["underscore", "marionette", "app/application", "text!app/account/signup/tpl/signup.html", "app/behavior/holdingdialog", "app/behavior/countdown", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header",
        template: e.template(n),
        behaviors: {
            HoldingDialog: {
                behaviorClass: o
            },
            CountDown: {
                behaviorClass: a,
                duration: 60,
                message: "s后重试",
                callback: function() {
                    this.$el.find("#verify-button").css("pointer-events", "initial").text("获取验证码")
                }
            },
            MessageBar: {
                behaviorClass: r
            }
        },
        serializeData: function() {
            return {
                ctx: i.ctx
            }
        },
        ui: {
            form: "#signup-form",
            verifyButton: "#verify-button"
        },
        events: {
            "tap @ui.verifyButton": "onTapVerifyButton",
            "submit @ui.form": "onSubmitForm"
        },
        onTapVerifyButton: function(e) {
            var t = $(e.target),
            n = this.$el.find('input[name="mobile"]'),
            o = n.val().trim();
            if (o && /^((13)|(15)|(17)|(18))\d{9}$/.test(o)) {
                t.css("pointer-events", "none");
                var a = this;
                $.ajax({
                    type: "POST",
                    url: i.ctx + "/api/verify-code",
                    data: {
                        mobile: o
                    }
                }).done(function(e) {
                    var i = JSON.parse(e);
                    "0" === i.code ? (a.triggerMethod("start:countdown"), a.triggerMethod("show:messagebar", "验证码发送成功", "success")) : (t.css("pointer-events", "initial"), a.triggerMethod("show:messagebar", i.message || "发送验证码失败", "danger"))
                }).fail(function(e) {
                    console.error(e),
                    a.triggerMethod("show:messagebar", "请求验证码失败", "danger")
                })
            } else this.triggerMethod("show:messagebar", "手机号码填写错误", "danger")
        },
        onSubmitForm: function(t) {
            var n = $(t.target);
            t.preventDefault();
            var o = n.validate("check");
            if (o.length) this.triggerMethod("show:messagebar", o[0], "danger");
            else {
                this.triggerMethod("show:holdingdialog");
                var a = e.object(n.serializeArray().map(function(t) {
                    return e.values(t)
                })),
                r = this,
                s = function() {
                    $.ajax({
                        type: "POST",
                        url: i.api + "/signup",
                        data: a
                    }).done(function(e) {
                        var t = JSON.parse(e);
                        "0" === t.code ? (r.triggerMethod("change:body:holdingdialog", t.message), setTimeout(function() {
                            r.triggerMethod("hide:holdingdialog"),
                            i.navigate("/profile", {
                                trigger: !0
                            })
                        },
                        1e3)) : r.triggerMethod("change:body:holdingdialog", t.message)
                    })
                };
                setTimeout(s, 800)
            }
        }
    })
}),
define("app/account/signup/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/header", "app/account/signup/view/signup"],
function(e, t, i, n, o, a) {
    "use strict";
    return t.Object.extend({
        showSignup: function() {
            var e = (new n).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "注册"
                })),
                this.showChildView("content", new a)
            });
            i.rootView.getRegion("page").show(e)
        }
    })
}),
define("text!app/account/password/tpl/forget.html", [],
function() {
    return '<form id="forget-form" method="post" data-validate="true">\n  <div class="field-row">\n    <label>手机号</label>\n    <input type="tel" class="form-control" name="mobile" placeholder="注册时使用的手机号码" data-alias="手机号码" data-validate="required|digit|length,11">\n  </div>\n  <div class="field-row">\n    <label>验证码</label>\n    <input type="tel" name="vcode" class="form-control has-xwide-suffix" placeholder="填写验证码" data-alias="验证码" data-validate="required">\n    <a href="javascript: void(0)" class="button button-small button-warning suffix xdd-button" data-toggle="countdown">获取验证码</a>\n  </div>\n  <div class="padding">\n    <button type="submit" class="button button-block button-warning xdd-button">\n      重&#x3000;置&#x3000;密&#x3000;码\n    </button>\n  </div>\n</form>'
}),
define("app/account/password/view/forget", ["underscore", "marionette", "app/application", "text!app/account/password/tpl/forget.html", "app/behavior/countdown", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o, a) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header",
        template: e.template(n),
        behaviors: {
            CountDown: {
                behaviorClass: o,
                duration: 60,
                message: "s后重试",
                callback: function() {
                    this.$el.find('[data-toggle="countdown"]').css("pointer-events", "initial").text("获取验证码")
                }
            },
            MessageBar: {
                behaviorClass: a
            }
        },
        serializeData: function() {
            return {
                ctx: i.ctx
            }
        },
        ui: {
            form: "#forget-form",
            button: '[data-toggle="countdown"]'
        },
        events: {
            "tap @ui.button": "onTapButton",
            "submit @ui.form": "onSubmitForm"
        },
        onTapButton: function(e) {
            var t = $(e.target),
            n = this.$el.find('input[name="mobile"]').val().trim();
            if (n && /^((13)|(15)|(17)|(18))\d{9}$/.test(n)) {
                t.css("pointer-events", "none");
                var o = this;
                $.ajax({
                    type: "POST",
                    url: i.api + "/account/password/verify-mobile",
                    data: {
                        mobile: n
                    }
                }).done(function(e) {
                    var i = JSON.parse(e);
                    "0" === i.code ? (o.triggerMethod("start:countdown"), o.triggerMethod("show:messagebar", "验证码发送成功", "success"), o.user = i.data) : (t.css("pointer-events", "initial"), o.triggerMethod("show:messagebar", i.message || "发送验证码失败", "danger"))
                }).fail(function(e) {
                    o.triggerMethod("show:messagebar", "请求验证码失败", "danger")
                })
            } else this.triggerMethod("show:messagebar", "手机号码填写错误", "danger")
        },
        onSubmitForm: function(t) {
            var n = $(t.target);
            t.preventDefault();
            var o = n.validate("check");
            if (o.length) this.triggerMethod("show:messagebar", o[0], "danger");
            else if (this.user && this.user.userId) {
                var a = e.object(n.serializeArray().map(function(t) {
                    return e.values(t)
                }));
                a.userId = this.user.userId;
                var r = this;
                $.ajax({
                    type: "POST",
                    url: i.api + "/account/password/confirm-mobile",
                    data: a
                }).done(function(e) {
                    var t = JSON.parse(e);
                    "0" === t.code ? (r.user.resetToken = t.data.resetToken, i.reqres.setHandler("account:password:reset:token",
                    function() {
                        return r.user
                    }), i.navigate("/password/reset", {
                        trigger: !0
                    })) : r.triggerMethod("show:messagebar", t.message, "danger")
                })
            } else this.triggerMethod("show:messagebar", "请重新获取验证码", "danger")
        }
    })
}),
define("text!app/account/password/tpl/reset.html", [],
function() {
    return '<form id="reset-form" method="post" data-validate="true">\n  <div class="field-row">\n    <label>新密码</label>\n    <input type="password" class="form-control" name="password" id="password" placeholder="6-20位字母或数字组成" data-alias="密码" data-validate="required|match,#confirmed-password|length_min,6|length_max,20">\n  </div>\n  <div class="field-row">\n    <label>确认密码</label>\n    <input type="password" class="form-control" id="confirmed-password" placeholder="再次输入密码" data-alias="确认密码" data-validate="required|match,#password|length_min,6|length_max,20">\n  </div>\n  <div class="padding">\n    <button type="submit" class="button button-block button-warning xdd-button">\n      确&#x3000;认&#x3000;修&#x3000;改\n    </button>\n  </div>\n</form>'
}),
define("app/account/password/view/reset", ["underscore", "marionette", "app/application", "text!app/account/password/tpl/reset.html", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header",
        template: e.template(n),
        behaviors: {
            MessageBar: {
                behaviorClass: o
            }
        },
        serializeData: function() {
            return {
                ctx: i.ctx
            }
        },
        initialize: function(e) {
            this.user = e.user
        },
        ui: {
            form: "#reset-form"
        },
        events: {
            "submit @ui.form": "onSubmitForm"
        },
        onSubmitForm: function(t) {
            var n = $(t.target);
            t.preventDefault();
            var o = n.validate("check");
            if (o.length) this.triggerMethod("show:messagebar", o[0], "danger");
            else {
                var a = e.object(n.serializeArray().map(function(t) {
                    return e.values(t)
                }));
                a.userId = this.user.userId,
                a.resetToken = this.user.resetToken;
                var r = this;
                $.ajax({
                    type: "POST",
                    url: i.api + "/account/password/reset",
                    data: a
                }).done(function(e) {
                    var t = JSON.parse(e);
                    "0" === t.code ? (r.triggerMethod("show:messagebar", "修改密码成功", "success", "3000"), setTimeout(function() {
                        window.location.href = i.ctx + "/login"
                    },
                    3e3)) : r.triggerMethod("show:messagebar", t.message, "danger")
                })
            }
        }
    })
}),
define("app/account/password/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/header", "app/account/password/view/forget", "app/account/password/view/reset"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showForgetPassword: function() {
            i.rootView.getRegion("page").show((new n).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "忘记密码"
                })),
                this.showChildView("content", new a)
            }))
        },
        showResetPassword: function() {
            var e = i.reqres.request("account:password:reset:token");
            return e && e.resetToken ? void i.rootView.getRegion("page").show((new n).once("before:show",
            function() {
                this.showChildView("header", new o({
                    title: "重置密码"
                })),
                this.showChildView("content", new r({
                    user: e
                }))
            })) : i.navigate("/password/forget", {
                trigger: !0
            })
        }
    })
}),
define("text!app/account/redenvelope/tpl/redenvelopes.html", [],
function() {
    return '<div class="red-envelope-wrap">\n  <div class="red-envelope-count">您共有<%= redEnvelopes.length %>个红包</div>\n  <% _.each(redEnvelopes.toJSON(), function(redEnvelope) { %>\n  <div class="red-envelope bg-red-envelope">\n    <div class="main">\n      <p>席多多</p>\n      <sub class="amount"></sub><span><%= redEnvelope.description %></span>\n      <% if(redEnvelope.minCharge > 0) { %>\n        <p>满<%= redEnvelope.minCharge / 100 %>元可用</p>\n      <% } %>\n      <% if(redEnvelope.limitProduct) { %>\n        <p>限定指定产品使用</p>\n      <% } %>\n    </div>\n    <div class="side">有效期<p><%= redEnvelope.beginTime %><br><%= redEnvelope.endTime %></p></div>\n    <i></i>\n  </div>\n  <% }) %>\n</div>'
}),
define("app/account/redenvelope/view/redenvelopes", ["underscore", "marionette", "app/application", "app/collection/redenvelopes", "text!app/account/redenvelope/tpl/redenvelopes.html"],
function(e, t, i, n, o) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header bg-gray",
        template: e.template(o),
        serializeData: function() {
            return {
                ctx: i.ctx,
                redEnvelopes: this.model
            }
        }
    })
}),
define("app/account/redenvelope/controller", ["jquery", "marionette", "app/application", "app/common/view/loading", "app/common/view/header", "app/common/view/page", "app/account/redenvelope/view/redenvelopes"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        listRedEnvelopes: function() {
            var t = (new a).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "我的红包"
                })),
                this.showChildView("content", new n)
            });
            i.rootView.getRegion("page").show(t);
            var s = i.reqres.request("redenvelope:entities");
            e.when(s).done(function(e) {
                t.showChildView("content", new r({
                    model: e
                }))
            })
        }
    })
}),
define("text!app/account/info/tpl/info.html", [],
function() {
    return '<div class="ucenter-space"></div>\n<div class="ucenter-content info">\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/profile/nickname">\n      昵称\n      <i class="icon-arrow-right"></i>\n      <% if(!!user.get(\'nickname\')) { %>\n        <span><%= user.get(\'nickname\') %></span>\n      <% } %>\n    </a>\n  </div>\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/profile/email">\n      邮箱\n      <i class="icon-arrow-right"></i>\n      <% if(!!user.get(\'email\')) { %>\n        <span><%= user.get(\'email\') %></span>\n      <% } %>\n    </a>\n  </div>\n  <div class="ucenter-item">\n    <a href="<%= ctx %>/profile/gender">\n      性别\n      <i class="icon-arrow-right"></i>\n      <% if(!!user.get(\'gender\')) { %>\n        <span><%= enums.gender[user.get(\'gender\')].description %></span>\n        <% } %>\n    </a>\n  </div>\n</div>\n\n<a href="<%= ctx %>/logout" data-bypass class="button button-full xdd-logout-button">退出登录</a>'
}),
define("app/account/info/view/info", ["underscore", "marionette", "app/application", "text!app/account/info/tpl/info.html"],
function(e, t, i, n) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                enums: i.enums(),
                user: this.model
            }
        }
    })
}),
define("text!app/account/info/tpl/nickname.html", [],
function() {
    return '<form class="nickname-form" data-validate="true">\n  <div class="info-update">\n    <input type="text" id="nickname" name="nickname" value="<%= user.get(\'nickname\') %>" placeholder="请填写新昵称" data-alias="昵称" data-validate="required|length_min,4|length_max,20" autofocus>\n  </div>\n  <div class="padding">\n    <button id="submit" class="button button-block button-warning xdd-button">确定</button>\n  </div>\n</form>'
}),
define("app/account/info/view/nickname", ["jquery", "underscore", "marionette", "app/application", "text!app/account/info/tpl/nickname.html", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o, a) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(o),
        serializeData: function() {
            return {
                ctx: n.ctx,
                user: this.user
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: a
            }
        },
        ui: {
            form: ".nickname-form"
        },
        events: {
            "submit @ui.form": "onSubmit"
        },
        initialize: function(e) {
            this.user = e.user,
            this.listenTo(this.user, "validated:invalid", this.onUserInvalid)
        },
        onSubmit: function(i) {
            i.preventDefault();
            var o = e(i.target),
            a = t.object(o.serializeArray().map(function(e) {
                return t.values(e)
            })),
            r = o.validate("check");
            this.user.isValid(!0) && !r.length ? this.user.save(a, {
                patch: !0,
                success: function() {
                    n.navigate("/profile/info", {
                        trigger: !0
                    })
                }
            }) : r.length && this.triggerMethod("show:messagebar", r[0], "danger")
        },
        onUserInvalid: function(e, t) {
            var i = t[Object.keys(t)[0]];
            this.triggerMethod("show:messagebar", i, "danger")
        }
    })
}),
define("text!app/account/info/tpl/email.html", [],
function() {
    return '<form class="email-form" data-validate="true">\n  <div class="info-update">\n    <input type="text" id="email" name="email" value="<%= user.get(\'email\') %>" placeholder="请填写新邮箱" data-alias="邮箱" data-validate="required|email" autofocus>\n  </div>\n  <div class="padding">\n    <button id="submit" class="button button-block button-warning xdd-button">确定</button>\n  </div>\n</form>'
}),
define("app/account/info/view/email", ["jquery", "underscore", "marionette", "app/application", "text!app/account/info/tpl/email.html", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o, a) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(o),
        serializeData: function() {
            return {
                ctx: n.ctx,
                user: this.user
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: a
            }
        },
        ui: {
            form: ".email-form"
        },
        events: {
            "submit @ui.form": "onSubmit"
        },
        initialize: function(e) {
            this.user = e.user,
            this.listenTo(this.user, "validated:invalid", this.onUserInvalid)
        },
        onSubmit: function(i) {
            i.preventDefault();
            var o = e(i.target),
            a = t.object(o.serializeArray().map(function(e) {
                return t.values(e)
            })),
            r = o.validate("check");
            this.user.isValid(!0) && !r.length ? this.user.save(a, {
                patch: !0,
                success: function() {
                    n.navigate("/profile/info", {
                        trigger: !0
                    })
                }
            }) : r.length && this.triggerMethod("show:messagebar", r[0], "danger")
        },
        onUserInvalid: function(e, t) {
            var i = t[Object.keys(t)[0]];
            this.triggerMethod("show:messagebar", i, "danger")
        }
    })
}),
define("text!app/account/info/tpl/gender.html", [],
function() {
    return '<form class="gender-form" data-validate="true">\n  <div class="info-update gender">\n    <input id="gender" type="hidden" name="gender" value="" data-alias="性别" data-validate="required">\n    <% _.each(genders, function(gender) { %>\n      <div data-code="<%= gender.code %>" class="gender-item <%= genders[user.get(\'gender\')] === gender ? \'gender-chosed\' : \'\' %>"><%= gender.description %></div>\n    <% }) %>\n  </div>\n  <div class="padding">\n    <button id="submit" class="button button-block button-warning xdd-button">确定</button>\n  </div>\n</form>'
}),
define("app/account/info/view/gender", ["jquery", "underscore", "marionette", "app/application", "text!app/account/info/tpl/gender.html", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o, a) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(o),
        serializeData: function() {
            return {
                ctx: n.ctx,
                user: this.user,
                genders: n.enums().gender
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: a
            }
        },
        ui: {
            gender: ".gender-item",
            form: ".gender-form"
        },
        events: {
            "click @ui.gender": "onChooseGender",
            "submit @ui.form": "onSubmit"
        },
        initialize: function(e) {
            this.user = e.user,
            this.listenTo(this.user, "validated:invalid", this.onUserInvalid)
        },
        onChooseGender: function(t) {
            var i = e(t.target).data("code");
            this.$('input[name="gender"]').val(i),
            this.$(".gender-item").removeClass("gender-chosed"),
            e(t.target).addClass("gender-chosed")
        },
        onSubmit: function(i) {
            i.preventDefault();
            var o = e(i.target),
            a = t.object(o.serializeArray().map(function(e) {
                return t.values(e)
            })),
            r = o.validate("check");
            this.user.isValid(!0) && !r.length ? this.user.save(a, {
                patch: !0,
                success: function() {
                    n.navigate("/profile/info", {
                        trigger: !0
                    })
                }
            }) : r.length && this.triggerMethod("show:messagebar", r[0], "danger")
        },
        onUserInvalid: function(e, t) {
            var i = t[Object.keys(t)[0]];
            this.triggerMethod("show:messagebar", i, "danger")
        }
    })
}),
define("app/account/info/controller", ["jquery", "marionette", "app/application", "app/common/view/loading", "app/common/view/header", "app/common/view/page", "app/account/info/view/info", "app/account/info/view/nickname", "app/account/info/view/email", "app/account/info/view/gender"],
function(e, t, i, n, o, a, r, s, l, d) {
    "use strict";
    return t.Object.extend({
        showInfo: function() {
            var t = (new a).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "我的资料"
                })),
                this.showChildView("content", new n)
            });
            i.rootView.getRegion("page").show(t);
            var s = i.reqres.request("account:entity");
            e.when(s).done(function(e) {
                var i = new r({
                    model: e
                });
                t.showChildView("content", i)
            })
        },
        nickname: function() {
            var t = (new a).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "修改昵称"
                })),
                this.showChildView("content", new n)
            });
            i.rootView.getRegion("page").show(t);
            var r = i.reqres.request("account:entity");
            e.when(r).done(function(e) {
                var i = new s({
                    user: e
                });
                t.showChildView("content", i)
            })
        },
        email: function() {
            var t = (new a).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "修改邮箱"
                })),
                this.showChildView("content", new n)
            });
            i.rootView.getRegion("page").show(t);
            var r = i.reqres.request("account:entity");
            e.when(r).done(function(e) {
                var i = new l({
                    user: e
                });
                t.showChildView("content", i)
            })
        },
        gender: function() {
            var t = (new a).once("before:show",
            function() {
                this.showChildView("header", new o({
                    backUrl: !0,
                    title: "修改性别"
                })),
                this.showChildView("content", new n)
            });
            i.rootView.getRegion("page").show(t);
            var r = i.reqres.request("account:entity");
            e.when(r).done(function(e) {
                var i = new d({
                    user: e
                });
                t.showChildView("content", i)
            })
        }
    })
}),
define("app/account/router", ["jquery", "marionette", "gta", "app/application", "app/model/user", "app/collection/orders", "app/collection/redenvelopes", "app/account/profile/controller", "app/account/signup/controller", "app/account/password/controller", "app/account/redenvelope/controller", "app/account/info/controller"],
function(e, t, i, n, o, a, r, s, l, d, c, p) {
    "use strict";
    var h = {
        _profileController: new s,
        _signupController: new l,
        _passwordController: new d,
        _redEnvelopeController: new c,
        _infoController: new p,
        _getAccountEntity: function() {
            var t = e.Deferred(),
            i = new o;
            return i.fetch({
                success: function(e) {
                    t.resolve(e)
                }
            }),
            t.promise()
        },
        _getUserOrderEntities: function() {
            var t = e.Deferred(),
            i = new a;
            return i.fetch({
                success: function(e) {
                    t.resolve(e)
                }
            }),
            t.promise()
        },
        _getUserRedEnvelopeEntities: function(t, i) {
            var n = e.Deferred(),
            o = new r;
            return o.fetch({
                data: {
                    productId: t,
                    quantity: i
                },
                success: function(e) {
                    n.resolve(e)
                }
            }),
            n.promise()
        },
        showProfile: function() {
            this._profileController.showProfile()
        },
        showSignup: function() {
            this._signupController.showSignup()
        },
        showForgetPassword: function() {
            this._passwordController.showForgetPassword()
        },
        showResetPassword: function() {
            this._passwordController.showResetPassword()
        },
        listRedEnvelopes: function() {
            this._redEnvelopeController.listRedEnvelopes()
        },
        showInfo: function() {
            this._infoController.showInfo()
        },
        nickname: function() {
            this._infoController.nickname()
        },
        email: function() {
            this._infoController.email()
        },
        gender: function() {
            this._infoController.gender()
        }
    };
    n.reqres.setHandler("account:entity",
    function() {
        return h._getAccountEntity()
    }),
    n.reqres.setHandler("order:entities",
    function() {
        return h._getUserOrderEntities()
    }),
    n.reqres.setHandler("redenvelope:entities",
    function(e, t) {
        return h._getUserRedEnvelopeEntities(e, t)
    });
    var u = t.AppRouter.extend({
        controller: h,
        onRoute: function(e, t, n) {
            i.pageview(t, n)
        },
        appRoutes: {
            signup: "showSignup",
            "password/forget": "showForgetPassword",
            "password/reset": "showResetPassword",
            profile: "showProfile",
            redenvelopes: "listRedEnvelopes",
            "profile/info": "showInfo",
            "profile/nickname": "nickname",
            "profile/email": "email",
            "profile/gender": "gender"
        }
    });
    return u
}),
define("text!app/order/detail/tpl/detail.html", [],
function() {
    return '<div class="order-progress">\n  <ul class="fancy-progress xdd-progress">\n    <li class="fancy-progress-step done">\n      <p class="content">订单已生成</p>\n      <div class="bar"></div>\n      <div class="node"></div>\n    </li>\n    <li class="fancy-progress-step <%= order.isPaid() ? \'done\' : \'doing\' %>">\n      <p class="content"><%= enums.orderStatus[order.get(\'orderStatus\')].description %></p>\n      <div class="node"></div>\n    </li>\n  </ul>\n</div>\n\n<div class="tableview order-spec">\n  <div class="view-content view-header">\n    <a class="view-inner chevron-right" href="<%= ctx %>/products/<%= order.get(\'product\').id %>">\n      <img class="view-inner-icon" src="<%= res %>/<%= order.get(\'product\').cover + \'!720.80A\' %>">\n      <span class="ellipsis"><%= order.get(\'product\').name %></span>\n    </a>\n  </div>\n  <div class="view-content">\n    <div class="view-inner">\n      <div class="item-lr">\n        <span class="lr-right">\n          &times;<%= order.get(\'quantity\') %>&#x3000;&#x3000;&#x3000;\n          &yen;<%= order.currency(order.get(\'price\'), 2) %>\n        </span>\n        <label class="lr-left">订单总价</label>  \n      </div>\n    </div>\n  </div>\n  <% if(!!promotion.redEnvelopeAmount) { %>\n    <div class="view-content">\n      <div class="view-inner">\n        <div class="item-lr">\n          <span class="lr-right xdd-text-danger">\n            - &yen;<%= order.currency(promotion.redEnvelopeAmount, 2) %>\n          </span>\n          <label class="lr-left xdd-text-danger">红包</label>  \n        </div>\n      </div>\n    </div>\n  <% } %>\n  <% if(!!promotion.adjustPrice) { %>\n    <div class="view-content">\n      <div class="view-inner">\n        <div class="item-lr">\n          <span class="lr-right xdd-text-danger">\n            <%= promotion.adjustPrice > 0 ? "" : "- " %>&yen;<%= order.currency(Math.abs(promotion.adjustPrice), 2) %>\n          </span>\n          <label class="lr-left xdd-text-danger">调整金额</label>  \n        </div>\n      </div>\n    </div>\n  <% } %>\n  <div class="view-content">\n    <div class="view-inner">\n      <div class="item-lr">\n        <span class="lr-right xdd-text-danger">\n          &yen;<%= order.currency(order.get(\'totalPayment\'), 2) %>\n        </span>\n        <label class="lr-left xdd-text-danger">合计</label>  \n      </div>\n    </div>\n  </div>\n</div>\n\n<% if (!!order.get(\'coupons\').length) { %>\n  <div class="tableview order-spec">\n    <div class="view-content view-header">\n      <div class="view-inner">消费券</div>\n    </div>\n    <% _.each(order.get(\'coupons\'), function(coupon) { %>\n      <div class="view-content">\n        <div class="view-inner <%= enums.couponStatus[coupon.status].code > enums.couponStatus[\'UNUSED\'].code ? \'sleepy\' : \'\' %> ">\n          <div class="item-lr">\n            <span class="lr-right"><%= enums.couponStatus[coupon.status].description %></span>\n            <label class="lr-left"><%= coupon.code %></label>  \n          </div>\n        </div>\n      </div>\n    <% }) %>\n  </div>\n<% } %>\n\n<div class="tableview order-spec">\n  <div class="view-content view-header">\n    <div class="view-inner">订单详情</div>\n  </div>\n  <div class="view-content">\n    <div class="view-inner">\n      <div class="item-lr">\n        <span class="lr-right"><%= order.get(\'code\') %></span>\n        <label class="lr-left">订单编号</label>  \n      </div>\n      <div class="item-lr">\n        <span class="lr-right"><%= order.formatDate(order.get(\'createTime\'), \'yy-mm-dd hh:ii:ss\') %></span>\n        <label class="lr-left">下单时间</label>\n      </div>\n      <div class="item-lr">\n        <span class="lr-right"><%= order.get(\'buyerProfile\').mobile %></span>\n        <label class="lr-left">手机号码</label>\n      </div>\n      <% if (order.get(\'reservations\').length) { %>\n        <div class="item-lr">\n          <span class="lr-right">\n            <% _.each(order.get(\'reservations\'), function(reservation) { %>\n              <p><%= order.formatDate(reservation.reserveDate, \'yy-mm-dd\') %></p>\n            <% }) %>\n          </span>\n          <label class="lr-left">预定日期</label>\n        </div>\n      <% } %>\n      <% if (!!order.get(\'payTime\')) { %>\n        <% if (!!order.get(\'paymentMethod\')) { %>\n          <div class="item-lr">\n            <span class="lr-right"><%= enums.paymentMethod[order.get(\'paymentMethod\')].description %></span>\n            <label class="lr-left">支付方式</label>\n          </div>\n        <% } %>\n        <div class="item-lr">\n          <span class="lr-right"><%= order.formatDate(order.get(\'payTime\'), \'yy-mm-dd hh:ii\') %></span>\n          <label class="lr-left">支付时间</label>\n        </div>\n      <% } %>\n    </div>\n  </div>\n</div>\n\n<% if (order.payable()) { %>\n  <div class="bar fixed-bottom order-bottom">\n    <a href="<%= ctx %>/<%= isDebug ? \'test\' : \'\' %>pay/orders/<%= order.get(\'id\') %>?showwxpaytitle=1" data-bypass class="button button-block button-warning xdd-button" data-category="f_order_to_pay" data-action="click" data-label="进入支付页">去支付</a>\n  </div>\n<% } %>\n\n<% if (order.get(\'refundable\')) { %>\n  <div class="bar fixed-bottom order-bottom">\n    <a href="<%= ctx %>/orders/<%= order.get(\'id\') %>/refund" class="button button-block button-warning xdd-button" data-category="f_order_to_refund" data-action="click" data-label="进入退款页">退款</a>\n  </div>\n<% } %>'
}),
define("app/order/detail/view/detail", ["underscore", "marionette", "app/application", "text!app/order/detail/tpl/detail.html", "dev"],
function(e, t, i, n, o) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header has-fixed-bottom",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                enums: i.enums(),
                isDebug: o.isDebugMode,
                isAndroid: o.isAndroid,
                order: this.model,
                promotion: this.model.get("promotion")
            }
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        },
        onAttach: function() {
            this.model.isPaid() || this.$el.addClass("has-footer")
        }
    })
}),
define("app/order/detail/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/order/detail/view/detail"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showOrder: function(t) {
            var s = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "订单详情"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(s);
            var l = i.reqres.request("order:entity", t);
            e.when(l).done(function(e) {
                s.showChildView("content", new r({
                    model: e
                }))
            })
        }
    })
}),
define("text!app/order/payment/tpl/pay.html", [],
function() {
    return '<div class="tableview order-spec">\n  <div class="view-content view-header">\n    <a class="view-inner" href="<%= ctx %>/products/<%= order.get(\'product\').id %>">\n      <img class="view-inner-icon" src="<%= res %>/<%= order.get(\'product\').cover + \'!720.80A\' %>">\n      <span class="ellipsis"><%= order.get(\'product\').name %></span>\n    </a>\n  </div>\n  <div class="view-content">\n    <div class="view-inner">\n      <div class="item-lr">\n        <span class="lr-right">\n          &times;<%= order.get(\'quantity\') %>&#x3000;&#x3000;&#x3000;\n          &yen;<%= order.currency(order.get(\'price\')) %>\n        </span>\n        <label class="lr-left">订单总价</label>\n      </div>\n    </div>\n  </div>\n  <div class="view-content">\n    <div class="view-inner">\n      <div class="item-lr">\n        <span class="lr-right xdd-text-danger">\n          &yen;<%= order.currency(order.get(\'totalPayment\')) %>\n        </span>\n        <label class="lr-left xdd-text-danger">合计</label>  \n      </div>\n    </div>\n  </div>\n</div>\n\n<!-- payment method -->\n<div class="list payment-method">\n\n  <div class="item title">请选择支付方式</div>\n  \n  <div class="item item-radio item-avatar payment-radio <%= dev.isWechatWeb ? \'\' : \'disabled\' %>">\n    <img src="<%= ctx %>/static/images/wechat-pay.png" class="item-image">\n    <div>微信支付</div>\n    <% if (!dev.isWechatWeb) { %>\n      <div class="small">请在微信客户端打开网页使用</div>\n    <% } %>\n    <% if (dev.isWechatWeb && !dev.isAboveWechat5) { %>\n      <div class="small">推荐安装微信5.0及以上版本的使用</div>\n    <% } %>\n    <label class="radio success">\n      <input type="radio" name="paymentMethod" value="/wxpay/prepare" <%= dev.isWechatWeb && dev.isAboveWechat5 ? \'\' : \'disabled\' %> >\n    </label>\n  </div>\n</div>\n<!-- payment method ends -->\n\n<div class="padding">\n  <a id="pay-button" href="javascript: void(0)" class="button button-block button-warning xdd-button" data-target="#modal" disabled>立即支付</a>\n</div>\n\n<div id="modal" class="modal fade holding-dialog">\n  <div class="modal-dialog text-center">\n    <a href="#" class="dismiss" data-dismiss="modal">&times;</a>\n    <div class="dialog-body">\n      <img src="${ctx.resource}/images/loader.gif"><br>\n      <span class="dialog-content">正在准备支付数据...</span>\n    </div>\n  </div>\n</div>'
}),
define("app/order/payment/view/pay", ["jquery", "underscore", "marionette", "app/application", "text!app/order/payment/tpl/pay.html", "app/behavior/holdingdialog", "dev", "wx"],
function(e, t, i, n, o, a, r, s) {
    "use strict";
    return i.ItemView.extend({
        className: "content has-header",
        template: t.template(o),
        serializeData: function() {
            return {
                ctx: n.ctx,
                res: n.res,
                dev: r,
                order: this.model
            }
        },
        behaviors: {
            HoldingDialog: {
                behaviorClass: a
            }
        },
        ui: {
            paymentMethod: '.payment-radio input[name="paymentMethod"]',
            payButton: "#pay-button"
        },
        events: {
            "change @ui.paymentMethod": "onPaymentMethodChange",
            "tap @ui.payButton": "onPayButtonTapped"
        },
        _getParentLayoutView: function() {
            return this._parent._parent._parent
        },
        onBeforeShow: function() {
            this._getParentLayoutView().$el.addClass("page-bg")
        },
        onPaymentMethodChange: function(t) {
            e(t.target).is(":checked") && e("#pay-button").removeAttr("disabled")
        },
        onPayButtonTapped: function() {
            var t = this.$(".payment-radio input:checked"),
            i = n.ctx + t.val(),
            o = {
                orderId: this.model.get("id"),
                currentUrl: window.location.href.split("#")[0]
            };
            this.triggerMethod("show:holdingdialog");
            var a = function() {
                setTimeout(function() {
                    window.location.reload()
                },
                1500)
            },
            l = this,
            d = e("#modal");
            e.ajax({
                type: "POST",
                url: i,
                data: o
            }).done(function(e) {
                var t = JSON.parse(e);
                if (1 == t.code) l.triggerMethod("change:body:holdingdialog", "支付数据初始化失败，请稍后重试..."),
                a();
                else {
                    var i = t.data.wechatJSConfig,
                    o = t.data.wechatPayConfig;
                    d.one("hidden:fancy:modal",
                    function() {
                        s.config({
                            debug: !!r.isDebugMode,
                            appId: i.appId,
                            timestamp: i.timestamp,
                            nonceStr: i.noncestr,
                            signature: i.signature,
                            jsApiList: ["chooseWXPay"]
                        }),
                        s.ready(function() {
                            s.chooseWXPay({
                                timestamp: o.timeStamp,
                                nonceStr: o.nonceStr,
                                "package": "prepay_id=" + o.prepayId,
                                signType: "MD5",
                                paySign: o.paySign,
                                success: function(e) {
                                    r.isDebugMode && (console.log("Wechat payment success."), console.dir(e)),
                                    n.navigate("/orders/" + this.model.get("id"), {
                                        trigger: !0
                                    })
                                }
                            })
                        })
                    }),
                    l.triggerMethod("hide:holdingdialog")
                }
            }).fail(function(e, t, i) {
                l.triggerMethod("change:body:holdingdialog", "请求失败..."),
                r.isDebugMode && (console.log(t), console.dir(i))
            })
        }
    })
}),
define("app/order/payment/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/order/payment/view/pay"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showPayment: function(t) {
            var s = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "订单支付"
                })),
                this.showChildView("content", new o)
            });
            i.rootView.getRegion("page").show(s);
            var l = i.reqres.request("order:entity", t);
            e.when(l).done(function(e) {
                s.showChildView("content", new r({
                    model: e
                }))
            })
        }
    })
}),
define("text!app/order/list/tpl/card.html", [],
function() {
    return '<h2 class="board-header list-style"><%= order.get(\'product\').name %></h2>\n<div class="board-content">\n  <p>订单编号：<%= order.get(\'code\') %></p>\n  <p>下单时间：<%= order.formatDate(order.get(\'createTime\'), \'yy-mm-dd hh:ii\') %></p>\n  <p>订单金额：&yen;&#x2002;<%= order.currency(order.get(\'totalPayment\'), 2) %></p>\n</div>\n<div class="board-footer">\n  <ul class="tabs justified">\n    <li>\n      <% if(order.get(\'orderStatus\') === \'UNPAID\') { %>\n        <a class="tab-item order-pay" href="<%= ctx %>/pay/orders/<%= order.get(\'id\') %>?showwxpaytitle=1" data-gta="event" data-category="f_order_to_pay" data-action="click" data-label="进入支付页" data-bypass>去付款</a>\n      <% } else if(order.get(\'refundable\')) { %>\n        <a href="<%= ctx %>/orders/<%= order.get(\'id\') %>/refund" class="tab-item">申请退款</a>\n      <% } else { %>\n        <p class="tab-item"><%= enums.orderStatus[order.get(\'orderStatus\')].description %></p>\n      <% } %>\n    </li>\n    <li>\n      <a href="<%= ctx %>/orders/<%= order.get(\'id\') %>" class="tab-item">详情</a>\n    </li>\n  </ul>\n</div>'
}),
define("app/order/list/view/card", ["underscore", "marionette", "app/application", "text!app/order/list/tpl/card.html"],
function(e, t, i, n) {
    "use strict";
    return t.ItemView.extend({
        className: "item xdd-board",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                order: this.model,
                enums: i.enums()
            }
        }
    })
}),
define("text!app/order/list/tpl/empty.html", [],
function() {
    return '<p class="xdd-text-info text-center">暂无订单数据</p>'
}),
define("app/order/list/view/empty", ["underscore", "marionette", "app/application", "text!app/order/list/tpl/empty.html"],
function(e, t, i, n) {
    "use strict";
    return t.ItemView.extend({
        className: "item no-border",
        template: e.template(n)
    })
}),
define("text!app/order/list/tpl/orders.html", [],
function() {
    return '<ul class="tabs justified profile-menu">\n  <li class="active"><a href="javascript: void(0)" data-filter=\'unpaid|unaudit\' class="tab-item">待付款</a></li>\n  <li><a href="javascript: void(0)" data-filter=\'paid|refunding\' class="tab-item">已付款</a></li>\n</ul>\n<div class="list margin-top-5"></div>'
}),
define("app/order/list/view/orders", ["underscore", "marionette", "app/application", "app/collection/orders", "app/order/list/view/card", "app/order/list/view/empty", "text!app/order/list/tpl/orders.html"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.CompositeView.extend({
        className: "content has-header",
        template: e.template(r),
        childView: o,
        childViewContainer: ".list",
        emptyView: a,
        serializeData: function() {
            return {
                ctx: i.ctx,
                order: this.model
            }
        },
        initialize: function() {
            this._fullCollection = new n,
            this._fullCollection.add(this.collection.models)
        },
        ui: {
            menuTab: ".tab-item[data-filter]"
        },
        events: {
            "tap @ui.menuTab": "onMenuTabTap"
        },
        collectionEvents: {
            "filter:status": "onFilterCollectionStatus"
        },
        onMenuTabTap: function(e) {
            $(".profile-menu > li").removeClass("active"),
            $(e.target).parent().addClass("active");
            var t = $(e.target).data("filter");
            this.collection.trigger("filter:status", t)
        },
        onFilterCollectionStatus: function(e) {
            var t = e.split("|"),
            i = this._fullCollection.filter(function(e) {
                return $.inArray(e.get("orderStatus").toLowerCase(), t) >= 0
            });
            this.collection.reset(i)
        }
    })
}),
define("app/order/list/controller", ["jquery", "backbone", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/common/view/navigation", "app/order/list/view/orders"],
function(e, t, i, n, o, a, r, s, l) {
    "use strict";
    return i.Object.extend({
        listOrders: function() {
            var t = (new o).once("before:show",
            function() {
                this.showChildView("header", new r({
                    backUrl: !0,
                    title: "我的订单"
                })),
                this.showChildView("content", new a)
            });
            n.rootView.getRegion("page").show(t);
            var i = n.reqres.request("order:entities");
            e.when(i).done(function(e) {
                t.showChildView("content", new l({
                    collection: e
                }).once("before:show",
                function() {
                    this.collection.trigger("filter:status", "unpaid|unaudit")
                }))
            })
        }
    })
}),
define("text!app/order/refund/tpl/refund.html", [],
function() {
    return '<div class="refund-container">\n  <h2>退款理由</h2>\n  <form class="refund-form" data-validate="true">\n    <div class="refund-reason">\n      <textarea placeholder="请输入退款理由" name="reason" data-alias="退款理由" data-validate="required"></textarea>\n    </div>\n    <div class="submit-refund">\n      <button id="submit" data-gta="event" data-category="f_order_refund_submit" data-action="click" data-label="订单退款">\n        提交\n      </button>\n    </div>\n  </form>\n  <div>\n    <h2>退款流程说明:</h2>\n    <div class="refund-process">\n      <div>用户申请</div>\n      <div><img src="/filet/static/images/icons/arrow.png" /></div>\n      <div>席多多审核通过</div>\n      <div><img src="/filet/static/images/icons/arrow.png" /></div>\n      <div>退回原始账户</div>\n      <div style="clear:both"></div>\n    </div>\n  </div>\n</div>'
}),
define("app/order/refund/view/refund", ["underscore", "marionette", "app/application", "text!app/order/refund/tpl/refund.html", "app/behavior/messagebar", "validate"],
function(e, t, i, n, o) {
    "use strict";
    return t.ItemView.extend({
        className: "content has-header",
        template: e.template(n),
        serializeData: function() {
            return {
                ctx: i.ctx,
                res: i.res,
                enums: i.enums(),
                order: this.model,
                promotion: this.model.get("promotion")
            }
        },
        behaviors: {
            MessageBar: {
                behaviorClass: o
            }
        },
        ui: {
            form: ".refund-form"
        },
        events: {
            "submit @ui.form": "onSubmitRefundApply"
        },
        onSubmitRefundApply: function(t) {
            t.preventDefault(),
            this.$("#submit").attr("disabled", "disabled");
            var n = $(t.target),
            o = e.object(n.serializeArray().map(function(t) {
                return e.values(t)
            })),
            a = n.validate("check");
            if (a.length) a.length && (this.$("#submit").removeAttr("disabled"), this.triggerMethod("show:messagebar", a[0], "danger"));
            else {
                var r = this;
                $.ajax({
                    type: "post",
                    url: i.api + "/account/orders/" + r.model.get("id") + "/refund",
                    data: o
                }).done(function(e) {
                    var t = JSON.parse(e);
                    "0" === t.code ? i.navigate("/orders/" + r.model.get("id"), {
                        trigger: !0
                    }) : (r.$("#submit").removeAttr("disabled"), r.triggerMethod("show:messagebar", t.message, "danger"))
                })
            }
        }
    })
}),
define("app/order/refund/controller", ["jquery", "marionette", "app/application", "app/common/view/page", "app/common/view/loading", "app/common/view/header", "app/order/refund/view/refund"],
function(e, t, i, n, o, a, r) {
    "use strict";
    return t.Object.extend({
        showRefund: function(t) {
            var o = (new n).once("before:show",
            function() {
                this.showChildView("header", new a({
                    backUrl: !0,
                    title: "申请退款"
                }))
            });
            i.rootView.getRegion("page").show(o);
            var s = i.reqres.request("order:entity", t);
            e.when(s).done(function(e) {
                o.showChildView("content", new r({
                    model: e
                }))
            })
        }
    })
}),
define("app/order/router", ["jquery", "marionette", "gta", "app/application", "app/collection/orders", "app/model/order", "app/order/detail/controller", "app/order/payment/controller", "app/order/list/controller", "app/order/refund/controller"],
function(e, t, i, n, o, a, r, s, l, d) {
    "use strict";
    var c = {
        _detailController: new r,
        _payController: new s,
        _listController: new l,
        _refundController: new d,
        showRefund: function(e) {
            this._refundController.showRefund(e)
        },
        _getOrderEntity: function(t) {
            var i = e.Deferred(),
            n = new a({
                id: t
            });
            return n.fetch({
                success: function(e) {
                    i.resolve(e)
                }
            }),
            i.promise()
        },
        _getUserOrderEntities: function() {
            var t = e.Deferred(),
            i = new o;
            return i.fetch({
                success: function(e) {
                    t.resolve(e)
                }
            }),
            t.promise()
        },
        showOrder: function(e) {
            this._detailController.showOrder(e)
        },
        showPayment: function(e) {
            this._payController.showPayment(e)
        },
        listOrders: function() {
            this._listController.listOrders()
        }
    };
    n.reqres.setHandler("order:entities",
    function() {
        return c._getUserOrderEntities()
    }),
    n.reqres.setHandler("order:entity",
    function(e) {
        return c._getOrderEntity(e)
    });
    var p = t.AppRouter.extend({
        controller: c,
        onRoute: function(e, t, n) {
            i.pageview(t, n)
        },
        appRoutes: {
            "orders/:id": "showOrder",
            "pay/orders/:id": "showPayment",
            "testpay/orders/:id": "showPayment",
            orders: "listOrders",
            "orders/:id/refund": "showRefund"
        }
    });
    return p
}),
define("app/workspace", ["backbone", "marionette", "app/product/router", "app/hotel/router", "app/account/router", "app/order/router"],
function(e, t, i, n, o, a) {
    "use strict";
    var r = t.Object.extend({
        initialize: function() {
            this.productRouter = new i,
            this.hotelRouter = new n,
            this.accountRouter = new o,
            this.orderRouter = new a
        }
    });
    return r
}),
require(["backbone", "app/application", "app/workspace"],
function(e, t, i) {
    "use strict";
    t.workspace = new i,
    t.start(),
    $(document).on("click", "a[href]:not([data-bypass])",
    function(i) {
        var n = {
            prop: $(this).prop("href"),
            attr: $(this).attr("href")
        },
        o = location.protocol + "//" + location.host + t.ctx;
        n.prop.slice(0, o.length) === o && (i.preventDefault(), e.history.navigate(n.attr.slice(t.ctx.length), !0))
    }),
    $(document).on("ajaxError",
    function(e, t) {
        401 === t.status && window.location.reload()
    })
}),
define("app/main",
function() {}),
require(["config"],
function() {
    "use strict";
    require(["rAF", "transition", "animation", "app/main"])
}),
define("app",
function() {});